From 328aafee2de45d4927017ce9b6ef927709aa9ba4 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 1 Aug 2019 16:22:23 -0400 Subject: [PATCH 01/58] Modify pkgdir for ubuntu16.04.5 x86 testcase --- .../testcase/installation/reg_linux_diskless_installation_flat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 b048d547a..59aaa36b0 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat @@ -34,7 +34,7 @@ cmd:if [ ! -d /tmp/mountoutput ]; then mkdir -p /tmp/mountoutput; fi cmd:mount |sort > /tmp/mountoutput/file.org cmd:cat /tmp/mountoutput/file.org cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu18.04.2" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ ppc64(el|le) ]] && [[ "__GETNODEATTR($$CN,mgt)__" =~ "kvm" ]] ; then mkdir -p /install/custom/netboot/ubuntu; sed -e 's@linux-image-generic-hwe-18.04@linux-image-generic@g' /install/custom/netboot/ubuntu/compute.ubuntu18.04.2.ppc64el.pkglist; chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute pkglist=/install/custom/netboot/ubuntu/compute.ubuntu18.04.2.ppc64el.pkglist; fi -cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -p pkgdir="http://archive.ubuntu.com/ubuntu xenial universe main,http://archive.ubuntu.com/ubuntu xenial-updates universe main,http://security.ubuntu.com/ubuntu xenial-security main restricted";fi +cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute; fi cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 From da5c7512116021cd1f3d314c59b145045418a0bc Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 2 Aug 2019 11:05:21 -0400 Subject: [PATCH 02/58] Modify pkgdir for ubuntu16.04.5 x86 testcase (2) --- ...nux_diskless_installation_flat_postscripts_failed | 2 +- .../reg_linux_diskless_installation_hierarchy | 2 +- xCAT-test/autotest/testcase/packimg/cases0 | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat_postscripts_failed b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat_postscripts_failed index 41391a68f..7b1bae418 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat_postscripts_failed +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat_postscripts_failed @@ -37,7 +37,7 @@ check:rc==0 cmd:if [ ! -d /tmp/mountoutput ]; then mkdir -p /tmp/mountoutput; fi cmd:mount |sort > /tmp/mountoutput/file.org cmd:cat /tmp/mountoutput/file.org -cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -p pkgdir="http://archive.ubuntu.com/ubuntu xenial universe main,http://archive.ubuntu.com/ubuntu xenial-updates universe main,http://security.ubuntu.com/ubuntu xenial-security main restricted";fi +cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute; fi cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute 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 bd8fe4876..478cfe9c5 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy @@ -37,7 +37,7 @@ check:rc==0 cmd:if [[ -f /test.synclist ]] ;then mv -f /test.synclist /test.synclist.bak;fi; cmd:echo "/test.synclist -> /test.synclist" > /test.synclist;chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=/test.synclist check:rc==0 -cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -p pkgdir="http://archive.ubuntu.com/ubuntu xenial universe main,http://archive.ubuntu.com/ubuntu xenial-updates universe main,http://security.ubuntu.com/ubuntu xenial-security main restricted";fi +cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute; fi cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 diff --git a/xCAT-test/autotest/testcase/packimg/cases0 b/xCAT-test/autotest/testcase/packimg/cases0 index d04d92940..0d7347087 100644 --- a/xCAT-test/autotest/testcase/packimg/cases0 +++ b/xCAT-test/autotest/testcase/packimg/cases0 @@ -64,7 +64,7 @@ cmd:if [ -x /usr/bin/goconserver ]; then makegocons $$CN; else makeconservercf $ check:rc==0 cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg /rootimg.bak;fi cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz /rootimg.cpio.gz.bak;fi -cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -p pkgdir="http://archive.ubuntu.com/ubuntu xenial universe main,http://archive.ubuntu.com/ubuntu xenial-updates universe main,http://security.ubuntu.com/ubuntu xenial-security main restricted";fi +cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute; fi cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 @@ -109,7 +109,7 @@ cmd:if [ -x /usr/bin/goconserver ]; then makegocons $$CN; else makeconservercf $ check:rc==0 cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg /rootimg.bak;fi cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz /rootimg.cpio.gz.bak;fi -cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -p pkgdir="http://archive.ubuntu.com/ubuntu xenial universe main,http://archive.ubuntu.com/ubuntu xenial-updates universe main,http://security.ubuntu.com/ubuntu xenial-security main restricted";fi +cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute; fi cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 @@ -158,7 +158,7 @@ cmd:if [ -x /usr/bin/goconserver ]; then makegocons $$CN; else makeconservercf $ check:rc==0 cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg /rootimg.bak;fi cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.xz;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.xz /rootimg.cpio.xz.bak;fi -cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -p pkgdir="http://archive.ubuntu.com/ubuntu xenial universe main,http://archive.ubuntu.com/ubuntu xenial-updates universe main,http://security.ubuntu.com/ubuntu xenial-security main restricted";fi +cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute; fi cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 @@ -203,7 +203,7 @@ cmd:if [ -x /usr/bin/goconserver ]; then makegocons $$CN; else makeconservercf $ check:rc==0 cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg /rootimg.bak;fi cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz /rootimg.tar.gz.bak;fi -cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -p pkgdir="http://archive.ubuntu.com/ubuntu xenial universe main,http://archive.ubuntu.com/ubuntu xenial-updates universe main,http://security.ubuntu.com/ubuntu xenial-security main restricted";fi +cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute; fi cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 @@ -263,7 +263,7 @@ cmd:if [ -x /usr/bin/goconserver ]; then makegocons $$CN; else makeconservercf $ check:rc==0 cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg /rootimg.bak;fi cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz /rootimg.tar.gz.bak;fi -cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -p pkgdir="http://archive.ubuntu.com/ubuntu xenial universe main,http://archive.ubuntu.com/ubuntu xenial-updates universe main,http://security.ubuntu.com/ubuntu xenial-security main restricted";fi +cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute; fi cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 @@ -319,7 +319,7 @@ cmd:if [ -x /usr/bin/goconserver ]; then makegocons $$CN; else makeconservercf $ check:rc==0 cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg /rootimg.bak;fi cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.xz;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.xz /rootimg.tar.xz.bak;fi -cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -p pkgdir="http://archive.ubuntu.com/ubuntu xenial universe main,http://archive.ubuntu.com/ubuntu xenial-updates universe main,http://security.ubuntu.com/ubuntu xenial-security main restricted";fi +cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute; fi cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 From ab86aa44025430bf751fec2e70b76a3d7771f152 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 12 Aug 2019 14:38:45 -0400 Subject: [PATCH 03/58] Add xCAT-buildkit to go-xcat uninstall list --- xCAT-server/share/xcat/tools/go-xcat | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index 50fbbe26d..e3d107630 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.41 +# Version 1.0.42 # # Copyright (C) 2016 - 2019 International Business Machines # Eclipse Public License, Version 1.0 (EPL-1.0) @@ -25,6 +25,8 @@ # - Better debug log when reading repository failed # 2019-07-24 Mark Gurevich # - Removed references to buildkit +# 2019-08-12 Mark Gurevich +# - Added xCAT-buildkit to uninstall list # function usage() @@ -176,11 +178,13 @@ GO_XCAT_INSTALL_LIST=(perl-xcat xcat xcat-client # The package list of all the packages should be installed GO_XCAT_UNINSTALL_LIST=("${GO_XCAT_INSTALL_LIST[@]}" goconserver xCAT-SoftLayer xCAT-confluent xCAT-csm xCAT-genesis-builder - xCAT-openbmc-py xCAT-probe xCAT-test xCAT-vlan xCATsn xCAT-UI-deps) + xCAT-openbmc-py xCAT-probe xCAT-test xCAT-vlan xCATsn xCAT-UI-deps + xCAT-buildkit) # For Debian/Ubuntu, it will need a sight different package list type dpkg >/dev/null 2>&1 && GO_XCAT_UNINSTALL_LIST=("${GO_XCAT_INSTALL_LIST[@]}" - goconserver xcat-confluent xcat-probe xcat-test xcat-vlan xcatsn) + goconserver xcat-confluent xcat-probe xcat-test xcat-vlan xcatsn + xcat-buildkit) PATH="/usr/sbin:/usr/bin:/sbin:/bin" export PATH From aab82ca6335a2ee44b7915ebc93b027bf8be9df4 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 15 Aug 2019 10:19:13 -0400 Subject: [PATCH 04/58] Remove conserver-xcat during uninstall --- xCAT-server/share/xcat/tools/go-xcat | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index e3d107630..4d128fe88 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.42 +# Version 1.0.43 # # Copyright (C) 2016 - 2019 International Business Machines # Eclipse Public License, Version 1.0 (EPL-1.0) @@ -27,6 +27,8 @@ # - Removed references to buildkit # 2019-08-12 Mark Gurevich # - Added xCAT-buildkit to uninstall list +# 2019-08-15 Mark Gurevich +# - Added conserver-xcat to uninstall list # function usage() @@ -179,12 +181,12 @@ GO_XCAT_INSTALL_LIST=(perl-xcat xcat xcat-client GO_XCAT_UNINSTALL_LIST=("${GO_XCAT_INSTALL_LIST[@]}" goconserver xCAT-SoftLayer xCAT-confluent xCAT-csm xCAT-genesis-builder xCAT-openbmc-py xCAT-probe xCAT-test xCAT-vlan xCATsn xCAT-UI-deps - xCAT-buildkit) + xCAT-buildkit conserver-xcat) # For Debian/Ubuntu, it will need a sight different package list type dpkg >/dev/null 2>&1 && GO_XCAT_UNINSTALL_LIST=("${GO_XCAT_INSTALL_LIST[@]}" goconserver xcat-confluent xcat-probe xcat-test xcat-vlan xcatsn - xcat-buildkit) + xcat-buildkit conserver-xcat) PATH="/usr/sbin:/usr/bin:/sbin:/bin" export PATH From f6bea60852cee1d9aad3ac5a51cb81162a3972ae Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 21 Aug 2019 16:57:00 -0400 Subject: [PATCH 05/58] Make repodata files readable by all --- builddep.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/builddep.sh b/builddep.sh index 97090a5a2..ee5b0e5b4 100755 --- a/builddep.sh +++ b/builddep.sh @@ -277,6 +277,10 @@ fi chgrp -R -h $SYSGRP * chmod -R g+w * +# Change permission on all repodata files to be readable by all +chmod a+r */*/repodata/*.gz +chmod a+r */*/repodata/*.bz2 + TARBALL_WORKING_DIR="${XCATCOREDIR}/${DESTDIR}" echo "===> Building the tarball at: ${TARBALL_WORKING_DIR} ..." # From b678ec0aa21b3c99990ae3832b46dea47c7d03ca Mon Sep 17 00:00:00 2001 From: jose_d Date: Mon, 26 Aug 2019 19:23:04 +0200 Subject: [PATCH 06/58] increase memory in kvm guide with current CentOS, download of kickstart file will fail when 1G memory is used. I believe it's related to this RHEL bug, https://bugzilla.redhat.com/show_bug.cgi?id=1595369, "Bug 1595369 - rhel 7.5 installation fails with 1GB ram ". --- .../admin-guides/manage_clusters/common/kvm/manage_vm.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/common/kvm/manage_vm.rst b/docs/source/guides/admin-guides/manage_clusters/common/kvm/manage_vm.rst index a40b77e1f..e4a511b35 100644 --- a/docs/source/guides/admin-guides/manage_clusters/common/kvm/manage_vm.rst +++ b/docs/source/guides/admin-guides/manage_clusters/common/kvm/manage_vm.rst @@ -39,7 +39,7 @@ After the VM object is created, several key attributes need to be specified with 4. the virtual memory size, with the unit "Megabit". Specify 1GB memory to "vm1" here: :: - chdef vm1 vmmemory=1024 + chdef vm1 vmmemory=2048 **Note**: For diskless node, the **vmmemory** should be at least 2048 MB, otherwise the node cannot boot up. From 8f1e64c1cd8cabab47478e7c58bebd6d47167eb3 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 27 Aug 2019 14:39:07 -0400 Subject: [PATCH 07/58] Testcase kdump increase sleep --- xCAT-test/autotest/testcase/kdump/linux_diskless_kdump | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/kdump/linux_diskless_kdump b/xCAT-test/autotest/testcase/kdump/linux_diskless_kdump index f5ed9e44a..0e0ba3104 100644 --- a/xCAT-test/autotest/testcase/kdump/linux_diskless_kdump +++ b/xCAT-test/autotest/testcase/kdump/linux_diskless_kdump @@ -71,8 +71,9 @@ check:output=~\d\d:\d\d:\d\d cmd:xdsh $$CN "echo 'echo 1 > /proc/sys/kernel/sysrq; echo c > /proc/sysrq-trigger' > /tmp/kdump.trigger" cmd:xdsh $$CN "chmod 755 /tmp/kdump.trigger" cmd:xdsh $$CN "service atd start" +cmd:sleep 30 cmd:xdsh $$CN "at now +1 minutes <<< /tmp/kdump.trigger" -cmd:sleep 300 +cmd:sleep 600 cmd:vmcorefile=`find /opt/xcat/share/xcat/tools/autotest/kdumpdir/ -name vmcore`;if [[ -s $vmcorefile ]]; then echo "this file is not empty";else echo "this file is empty"; fi check:output=~not empty From 9fb1cbe86a056a8aa1c9596c91d6a039b88d51bf Mon Sep 17 00:00:00 2001 From: jose_d Date: Wed, 28 Aug 2019 17:15:26 +0200 Subject: [PATCH 08/58] documentation: kvm: simplify wording --- .../admin-guides/manage_clusters/common/kvm/manage_vm.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/common/kvm/manage_vm.rst b/docs/source/guides/admin-guides/manage_clusters/common/kvm/manage_vm.rst index e4a511b35..de9392756 100644 --- a/docs/source/guides/admin-guides/manage_clusters/common/kvm/manage_vm.rst +++ b/docs/source/guides/admin-guides/manage_clusters/common/kvm/manage_vm.rst @@ -37,7 +37,7 @@ After the VM object is created, several key attributes need to be specified with chdef vm1 vmhost=kvmhost1 -4. the virtual memory size, with the unit "Megabit". Specify 1GB memory to "vm1" here: :: +4. the virtual memory size (in Megabytes): :: chdef vm1 vmmemory=2048 From 910261fb62268d7c94c6ff6b62ed166fa76cbaf4 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 29 Aug 2019 09:48:27 -0400 Subject: [PATCH 09/58] Fix spelling and formatting in manage_vm doc --- .../manage_clusters/common/kvm/manage_vm.rst | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/common/kvm/manage_vm.rst b/docs/source/guides/admin-guides/manage_clusters/common/kvm/manage_vm.rst index de9392756..69a8a5ee6 100644 --- a/docs/source/guides/admin-guides/manage_clusters/common/kvm/manage_vm.rst +++ b/docs/source/guides/admin-guides/manage_clusters/common/kvm/manage_vm.rst @@ -1,5 +1,5 @@ Manage Virtual Machine (VM) -============================ +=========================== Now the PowerKVM hypervisor "kvmhost1" is ready, this section introduces the VM management in xCAT, including examples on how to create, remove and clone VMs. @@ -41,8 +41,6 @@ After the VM object is created, several key attributes need to be specified with chdef vm1 vmmemory=2048 -**Note**: For diskless node, the **vmmemory** should be at least 2048 MB, otherwise the node cannot boot up. - 5. Define the virtual network card, it should be set to the bridge "br0" which has been created in the hypervisor. If no bridge is specified, no network device will be created for the VM node "vm1": :: chdef vm1 vmnics=br0 @@ -62,27 +60,27 @@ After the VM object is created, several key attributes need to be specified with B. Create storage on a device of hypervisor - The format is 'phy:/dev/sdb1': :: + The format is ``phy:/dev/sdb1``: :: chdef vm1 vmstorage=phy:/dev/sdb1 C. Create storage on a directory of hypervisor - The format is 'dir:///var/lib/libvirt/images': :: + The format is ``dir:///var/lib/libvirt/images``: :: chdef vm1 vmstorage=dir:///var/lib/libvirt/images - **Note**: The attribute **vmstorage** is only valid for diskful VM node. +.. note:: The attribute **vmstorage** is only valid for diskful VM node. 8. Define the **console** attributes for VM: :: chdef vm1 serialport=0 serialspeed=115200 -9. (optional)For monitoring and access the VM with vnc client, set **vidpassword** value: :: +9. (Optional) For monitoring and access the VM with vnc client, set **vidpassword** value: :: chtab node=vm1 vm.vidpassword=abc123 -10. (optional)For assigning PCI devices to the VM, set **othersettings** value: :: +10. (Optional) For assigning PCI devices to the VM, set **othersettings** value: :: chtab node=vm1 vm.othersettings="devpassthrough:0000:01:00.2" @@ -133,7 +131,7 @@ When "vm1" is created successfully, a VM hard disk file with a name like "vm1.sd lsdef vm1 -i mac -Now a VM "vm1" is created, it can be provisioned like any other nodes in xCAT. The VM node can be powered on by: :: +Once a VM "vm1" is created, it can be provisioned like any other node in xCAT. The VM node can be powered on by: :: rpower vm1 on @@ -164,9 +162,9 @@ When the VM has been created and powered on, choose one of the following methods makegocons vm1 rcons vm1 -* Connect to virtual machine through vnc console +* Connect to virtual machine through ``vnc`` console - In order to connect the virtual machine's vnc server, a new set of credentials need to be generated by running: :: + In order to connect the virtual machine's ``vnc`` server, a new set of credentials need to be generated by running: :: xcatclient getrvidparms vm1 vm1: method: kvm @@ -176,10 +174,10 @@ When the VM has been created and powered on, choose one of the following methods vm1: server: kvmhost1 vm1: vidport: 5900 - **Note**: Now just pick a favorite vnc client to connect the hypervisor, with the password generated by ``getrvidparms``. If the vnc client complains "the password is not valid", the reason might be that the hypervisor and headnode clocks are out of sync! Please try to sync them by running ``ntpdate `` on both the hypervisor and the headnode. +.. note:: Now just pick a favorite ``vnc`` client to connect the hypervisor, with the password generated by ``getrvidparms``. If the ``vnc`` client complains "the password is not valid", the reason might be that the hypervisor and headnode clocks are out of sync! Please try to sync them by running ``ntpdate `` on both the hypervisor and the headnode. -* Use wvid on management node +* Use ``wvid`` on management node Make sure **firewalld** service is stopped, disable it if not: :: @@ -214,7 +212,7 @@ Clone the virtual machine **Clone** is an operation that creating a VM from an existed one by inheriting most of its attributes and data. -The general step of **clone** a VM is like this: first creating a **VM master** , then creating a VM with the newly created **VM master** in **attaching** or **detaching** mode. +Steps to **clone** a VM: first create a **VM master** , then create a VM with the newly created **VM master** in **attaching** or **detaching** mode. **In attaching mode** From 3c2fbbc61746d28fa2b75e840011dd36f5e62a98 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 3 Sep 2019 11:27:33 -0400 Subject: [PATCH 10/58] Health check xcat-dep files before building tar and remove AIX support --- builddep.sh | 284 +++++++++++++++++++++++++--------------------------- 1 file changed, 135 insertions(+), 149 deletions(-) diff --git a/builddep.sh b/builddep.sh index ee5b0e5b4..2cb1357b0 100755 --- a/builddep.sh +++ b/builddep.sh @@ -17,6 +17,11 @@ # UP=0 or UP=1 - override the default upload behavior # FRSYUM=0 - put the directory of individual rpms in the project web area instead # of the FRS area. +# CHECK=0 or 1 - verify proper file location and links. Default is to check. +# Verifies all noarch files in ..../// are links +# Verifies no broken link files in ..../// +# Verifies there are no multiple, real (non-link) files with the same name +# Verifies all real (non-link) files have a link to it # VERBOSE=1 - Set to 1 to see more VERBOSE output # This script should only be run on RPM based machines @@ -30,10 +35,14 @@ fi USER=xcat TARGET_MACHINE=xcat.org +BASE_GSA=/gsa/pokgsa/projects/x/xcat/build +GSA=$BASE_GSA/linux/xcat-dep + FRS=/var/www/xcat.org/files/xcat OSNAME=$(uname) UP=0 +CHECK=1 # Process cmd line variable assignments, assigning each attr=val pair to a variable of same name for i in $*; do # upper case the variable name @@ -41,13 +50,7 @@ for i in $*; do export $varstring done -if [ "$OSNAME" == "AIX" ]; then - DFNAME=dep-aix-`date +%Y%m%d%H%M`.tar.gz - GSA=/gsa/pokgsa/projects/x/xcat/build/aix/xcat-dep -else - DFNAME=xcat-dep-`date +%Y%m%d%H%M`.tar.bz2 - GSA=/gsa/pokgsa/projects/x/xcat/build/linux/xcat-dep -fi +DFNAME=xcat-dep-`date +%Y%m%d%H%M`.tar.bz2 if [ ! -d $GSA ]; then echo "ERROR: This script is intended to be used by xCAT development..." @@ -117,6 +120,81 @@ function checkrc { fi } +# Verify files in $GSA +if [[ ${CHECK} -eq 1 ]]; then + ERROR=0 + LINKED_TO_FILES_ARRAY=[] + counter=0 + OSes=`find $GSA -maxdepth 1 -mindepth 1 -type d` + for os in $OSes; do + ARCHes=`find $os -maxdepth 1 -mindepth 1 -type d` + for arch in $ARCHes; do + + # Find regular noarch.rpm files in / directory + for file in `find $arch -type f -name "*noarch.rpm"`; do + ERROR=1 + echo -e "\nError: Regular 'noarch' file $file found in 'arch' directory. Expected a link." + done + + # Find broken links file + for file in `find $arch -xtype l -name "*noarch.rpm"`; do + ERROR=1 + echo -e "\nError: Broken link file $file" + done + + # Save a link of everything being linked to for later use + for link_file in `find $arch -type l -name "*.rpm"`; do + LINKED_TO_FILE=`realpath --relative-to=$GSA $link_file` + LINKED_TO_FILES_ARRAY[$counter]=$LINKED_TO_FILE + counter=$counter+1 + done + + + done + done + + # Find identical files in $GSA and $GSA/ directory + for short_file in $GSA/*.rpm; do + basename=$(basename -- "$short_file") + DUP_FILES=`find $GSA/*/ -type f -name $basename` + if [[ ! -z $DUP_FILES ]]; then + ERROR=1 + echo -e "\nError: Multiple real files with the same name found ($basename):" + for dup_file in `find $GSA -type f -name $basename`; do + ls -l $dup_file + done + fi + done + + if [ -n "$VERBOSEMODE" ]; then + # In verbose mode print contents of array containing all the files someone links to from / + for var in "${LINKED_TO_FILES_ARRAY[@]}"; do + echo "Symlink detected to file: ${var} " + done + fi + + echo " " + # Find all files no one links to + REAL_FILES=`find $GSA/* -maxdepth 1 -type f -name "*.rpm" | cut -d / -f 10,11 --output-delimiter="/"` + for file in $REAL_FILES; do + FOUND=0 + for used_link in "${LINKED_TO_FILES_ARRAY[@]}"; do + if [[ $file == $used_link ]]; then + FOUND=1 + break + fi + done + if [[ ${FOUND} -eq 0 ]]; then + echo "Warning: No symlinks to file: $GSA/$file" + fi + done + + if [[ ${ERROR} -eq 1 ]]; then + echo -e "\nErrors found verifying files. Rerun this script with CHECK=0 to skip file verification." + exit 1 + fi +fi + WORKING_TARGET_DIR="${DESTDIR}/xcat-dep" # Sync from the GSA master copy of the dep rpms mkdir -p ${WORKING_TARGET_DIR} @@ -132,148 +210,63 @@ cd ${WORKING_TARGET_DIR} # add a comment to indicate the latest xcat-dep tar ball name sed -i -e "s#REPLACE_LATEST_SNAP_LINE#The latest xcat-dep tar ball is ${DFNAME}#g" README -if [ "$OSNAME" != "AIX" ]; then - # Get gpg keys in place - mkdir -p ${GNU_KEYDIR} - checkrc - for i in pubring.gpg secring.gpg trustdb.gpg; do - if [ ! -f ${GNU_KEYDIR}/$i ] || [ `wc -c ${GNU_KEYDIR}/$i|cut -f 1 -d' '` == 0 ]; then - rm -f ${GNU_KEYDIR}/$i - cp $GSA/../keys/$i ${GNU_KEYDIR} - chmod 600 ${GNU_KEYDIR}/$i - fi - done - - # Tell rpm to use gpg to sign - if ! $GREP -q '%_signature gpg' $MACROS 2>/dev/null; then - echo '%_signature gpg' >> $MACROS +# Get gpg keys in place +mkdir -p ${GNU_KEYDIR} +checkrc +for i in pubring.gpg secring.gpg trustdb.gpg; do + if [ ! -f ${GNU_KEYDIR}/$i ] || [ `wc -c ${GNU_KEYDIR}/$i|cut -f 1 -d' '` == 0 ]; then + rm -f ${GNU_KEYDIR}/$i + cp $GSA/../keys/$i ${GNU_KEYDIR} + chmod 600 ${GNU_KEYDIR}/$i fi - 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)' - - # Create the repodata dirs - echo "===> Creating repodata directories..." - for i in `find -mindepth 2 -maxdepth 2 -type d `; do - if [ -n "$VERBOSEMODE" ]; then - createrepo $i # specifying checksum so the repo will work on rhel5 - else - createrepo $i >/dev/null - fi - rm -f $i/repodata/repomd.xml.asc - gpg -a --detach-sign --default-key 5619700D $i/repodata/repomd.xml - if [ ! -f $i/repodata/repomd.xml.key ]; then - cp $GSA/../keys/repomd.xml.key $i/repodata - fi - done - - # Modify xcat-dep.repo files to point to the correct place - echo "===> Modifying the xcat-dep.repo files to point to the correct location..." - - echo "===> Making sure that the mklocalrepo.sh file contains execute permission ..." - ls -ltr ${XCATCOREDIR}/${WORKING_TARGET_DIR}/mklocalrepo.sh - if [[ ! -x "${XCATCOREDIR}/${WORKING_TARGET_DIR}/mklocalrepo.sh" ]]; then - echo "===> --- found not execute, changing +x ..." - chmod +x ${XCATCOREDIR}/${WORKING_TARGET_DIR}/mklocalrepo.sh - fi - - echo "===> Checking if 'replacelinks' is in the xcat-deps, removing if there ..." - if [[ -f ${XCATCOREDIR}/${WORKING_TARGET_DIR}/replacelinks ]]; then - rm -f ${XCATCOREDIR}/${WORKING_TARGET_DIR}/replacelinks - fi -fi - -if [ "$OSNAME" == "AIX" ]; then - # Build the instoss file ------------------------------------------ - - cat >instoss << 'EOF' -#!/bin/ksh -# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html -# xCAT on AIX - prerequisite install script -cd `dirname $0` -PERLVER=`perl -v|grep 'This is perl'|cut -d' ' -f 4` -if [ "$PERLVER" == "v5.8.2" ]; then - OSVER='5.3' -elif [ "$PERLVER" == "v5.8.8" ]; then - OSVER='6.1' - aixver=`lslpp -lc|grep 'bos.rte:'|head -1|cut -d: -f3` - if [[ $aixver < '6.1.9.0' ]]; then - AIX61Y=0 - else - AIX61Y=1 - fi -elif [ "$PERLVER" == "v5.10.1" ]; then - OSVER='7.1' - aixver=`lslpp -lc|grep 'bos.rte:'|head -1|cut -d: -f3` - if [[ $aixver < '7.1.3.0' ]]; then - AIX71L=0 - else - AIX71L=1 - fi - -else - echo "Error: the perl version of '$PERLVER' is not one that instoss understands. Exiting..." - exit 2 -fi -cd $OSVER -# Have to install rpms 1 at a time, since some may be already installed. -# The only interdependency between the dep rpms so far is that net-snmp requires bash, and -# pyodbc requires unixODBC. (The bash dependency is taken care of automatically because it -# comes earlier in the alphabet.) - -# first run /usr/sbin/updtvpkg to make sure any installp software is -# registered with RPM. -echo "Running updtvpkg. This could take a few minutes." -/usr/sbin/updtvpkg -echo "updtvpkg has completed." - -# unixODBC is required by pyodbc, so install it first -rpm -Uvh unixODBC* -# Now install the bulk of the rpms, one at a time, in case some are already installed -for i in `ls *.rpm|grep -v -E '^tcl-|^tk-|^expect-|^unixODBC-|^xCAT-UI-deps|^perl-DBD-DB2Lite|^net-snmp'`; do - if [ "$i" == "perl-Net-DNS-0.66-1.aix5.3.ppc.rpm" ]; then - opts="--nodeps" - else - opts="" - fi - - # On 7.1L and 6.1Y we need a newer version of perl-Net_SSLeay.pm - if [[ $AIX71L -eq 1 || $AIX61Y -eq 1 ]]; then - if [[ $i == perl-Net_SSLeay.pm-1.30-* ]]; then continue; fi # skip the old rpm - else - if [[ $i == perl-Net_SSLeay.pm-1.55-* ]]; then continue; fi # skip the new rpm - fi - - echo rpm -Uvh $opts $i - rpm -Uvh $opts $i done -# Have to upgrade all of the net-snmp rpms together because they depend on each other. -# Also, they require bash, so do it after the loop, rather than before -rpm -Uvh net-snmp* -EOF -# end of instoss file content --------------------------------------------- +# Tell rpm to use gpg to sign +if ! $GREP -q '%_signature gpg' $MACROS 2>/dev/null; then + echo '%_signature gpg' >> $MACROS +fi +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)' - chmod +x instoss +# Create the repodata dirs +echo "===> Creating repodata directories..." +for i in `find -mindepth 2 -maxdepth 2 -type d `; do + if [ -n "$VERBOSEMODE" ]; then + createrepo $i # specifying checksum so the repo will work on rhel5 + else + createrepo $i >/dev/null + fi + rm -f $i/repodata/repomd.xml.asc + gpg -a --detach-sign --default-key 5619700D $i/repodata/repomd.xml + if [ ! -f $i/repodata/repomd.xml.key ]; then + cp $GSA/../keys/repomd.xml.key $i/repodata + fi +done + +# Modify xcat-dep.repo files to point to the correct place +echo "===> Modifying the xcat-dep.repo files to point to the correct location..." + +echo "===> Making sure that the mklocalrepo.sh file contains execute permission ..." +ls -ltr ${XCATCOREDIR}/${WORKING_TARGET_DIR}/mklocalrepo.sh +if [[ ! -x "${XCATCOREDIR}/${WORKING_TARGET_DIR}/mklocalrepo.sh" ]]; then + echo "===> --- found not execute, changing +x ..." + chmod +x ${XCATCOREDIR}/${WORKING_TARGET_DIR}/mklocalrepo.sh +fi + +echo "===> Checking if 'replacelinks' is in the xcat-deps, removing if there ..." +if [[ -f ${XCATCOREDIR}/${WORKING_TARGET_DIR}/replacelinks ]]; then + rm -f ${XCATCOREDIR}/${WORKING_TARGET_DIR}/replacelinks fi # Get the permissions and group correct -if [ "$OSNAME" == "AIX" ]; then - # AIX - SYSGRP=system - YUM=aix - FRSDIR='2.x_AIX' -else - # Linux - SYSGRP=root - YUM=yum/devel - FRSDIR='2.x_Linux' -fi +SYSGRP=root +YUM=yum/devel +FRSDIR='2.x_Linux' chgrp -R -h $SYSGRP * chmod -R g+w * @@ -298,14 +291,7 @@ if [ -n "$VERBOSEMODE" ]; then fi echo "===> Creating $DFNAME ..." -if [ "$OSNAME" == "AIX" ]; then - tar $verbosetar -cf ${DFNAME%.gz} xcat-dep - rm -f $DFNAME - gzip ${DFNAME%.gz} -else - # Linux - tar $verbosetar -jcf $DFNAME xcat-dep -fi +tar $verbosetar -jcf $DFNAME xcat-dep if [[ ${UP} -eq 0 ]]; then echo "Upload not being done, set UP=1 to upload to xcat.org" From 7fd2b54dce2c44cd5c58b81ebb9a38542bfc1411 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 5 Sep 2019 11:14:59 -0400 Subject: [PATCH 11/58] Make xcat-dep tar file readable by all --- builddep.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/builddep.sh b/builddep.sh index 2cb1357b0..3344c2aa5 100755 --- a/builddep.sh +++ b/builddep.sh @@ -292,6 +292,7 @@ fi echo "===> Creating $DFNAME ..." tar $verbosetar -jcf $DFNAME xcat-dep +chmod a+r $DFNAME if [[ ${UP} -eq 0 ]]; then echo "Upload not being done, set UP=1 to upload to xcat.org" From 5dbe9f202601a2a272363d5f904bf6c7e976af27 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 12 Sep 2019 14:38:21 -0400 Subject: [PATCH 12/58] Openbmc hardware control with OP940 --- xCAT-server/lib/perl/xCAT/OPENBMC.pm | 10 ++++++++++ xCAT-server/lib/xcat/plugins/openbmc.pm | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/OPENBMC.pm b/xCAT-server/lib/perl/xCAT/OPENBMC.pm index 9a4ab02ec..85188c14b 100644 --- a/xCAT-server/lib/perl/xCAT/OPENBMC.pm +++ b/xCAT-server/lib/perl/xCAT/OPENBMC.pm @@ -25,6 +25,8 @@ use xCAT::TableUtils; my $PYTHON_AGENT_FILE = "/opt/xcat/lib/python/agent/agent.py"; my $header = HTTP::Headers->new('Content-Type' => 'application/json'); +# Currently not used, example of header to use for authorization +#my $header = HTTP::Headers->new('X-Auth-Token' => 'xfMHrrxdMgbiITnX0TlN'); sub new { my $async = shift; @@ -44,8 +46,16 @@ sub send_request { my $method = shift; my $url = shift; my $content = shift; + my $username = shift; + my $password = shift; my $request = HTTP::Request->new( $method, $url, $header, $content ); + if (defined $username and defined $password) { + # If username and password were passed in use authorization_basic() + # This is required to connect to BMC with OP940 level, ignored for + # lower OP levels + $request->authorization_basic($username, $password); + } my $id = $async->add_with_opts($request, {}); return $id; } diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 952922b76..4b902c9c1 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -2452,7 +2452,7 @@ sub gen_send_request { } process_debug_info($node, $debug_info); } - my $handle_id = xCAT::OPENBMC->send_request($async, $method, $request_url, $content); + my $handle_id = xCAT::OPENBMC->send_request($async, $method, $request_url, $content, $node_info{$node}{username}, $node_info{$node}{password}); $handle_id_node{$handle_id} = $node; $node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} }; @@ -4212,7 +4212,7 @@ sub rspconfig_dump_response { sub dump_download_process { my $node = shift; - my $request_url = "$http_protocol://" . $node_info{$node}{bmc}; + my $request_url = "$http_protocol://" . $node_info{$node}{username} . ":" . $node_info{$node}{password} . "@" . $node_info{$node}{bmc}; my $content_login = '{ "data": [ "' . $node_info{$node}{username} .'", "' . $node_info{$node}{password} . '" ] }'; my $content_logout = '{ "data": [ ] }'; my $cjar_id = "/tmp/_xcat_cjar.$node"; @@ -4876,7 +4876,7 @@ sub rflash_response { sub rflash_upload { my ($node, $callback) = @_; - my $request_url = "$http_protocol://" . $node_info{$node}{bmc}; + my $request_url = "$http_protocol://" . $node_info{$node}{username} . ":" . $node_info{$node}{password} . "@" . $node_info{$node}{bmc}; my $content_login = '{ "data": [ "' . $node_info{$node}{username} .'", "' . $node_info{$node}{password} . '" ] }'; my $content_logout = '{ "data": [ ] }'; my $cjar_id = "/tmp/_xcat_cjar.$node"; From 1204fc0550f05937ecf1b978fd6739c4d2f3c0e1 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 17 Sep 2019 15:02:21 -0400 Subject: [PATCH 13/58] Ubuntu dependency build --- build-ubunturepo | 69 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 53 insertions(+), 16 deletions(-) diff --git a/build-ubunturepo b/build-ubunturepo index 76d981c21..94afcaff9 100755 --- a/build-ubunturepo +++ b/build-ubunturepo @@ -24,6 +24,10 @@ # prep for a release. # GPGSIGN=0 - Do not sign the repo in the end of the build. The repo will be signed by default # +# LOCAL_KEY=1 Use local keys to sign repo instead of WGET from GSA. By default use GSA. +# +# SETUP=1 Setup environment for build. By default do not setup environment. +# # LOG= - provide an LOG file option to redirect some output into log file # # DEST= - provide a directory to contains the build result @@ -48,16 +52,8 @@ if [[ ! -f /etc/lsb-release ]]; then fi . /etc/lsb-release -# Check the necessary packages before starting the build -declare -a packages=( "reprepro" "devscripts" "debhelper" "libsoap-lite-perl" "libdbi-perl" "quilt" "git") +export HOME=/root -for package in ${packages[@]}; do - RC=`dpkg -l | grep $package >> /dev/null 2>&1; echo $?` - if [[ ${RC} != 0 ]]; then - echo "ERROR: Could not find $package, install using 'apt-get install $package' to continue" - exit 1 - fi -done # Process cmd line variable assignments, assigning each attr=val pair to a variable of same name for i in $*; do @@ -70,6 +66,44 @@ for i in $*; do export $varstring done +#Setup environment so the xcat-deps can be built on a FVT test machine +if [ "$SETUP" = "1" ];then + #Mount GSA + POKGSA="/gsa/pokgsa" + POKGSA2="/gsa/pokgsa-p2" + POKGSAIBM="pokgsa.ibm.com" + if [ ! -d $POKGSA ];then + mkdir -p $POKGSA + mount ${POKGSAIBM}:${POKGSA} ${POKGSA} + fi + if [ ! -d $POKGSA2 ];then + mkdir -p $POKGSA2 + mount ${POKGSAIBM}:${POKGSA2} ${POKGSA2} + fi + + # Verify needed packages installed + REPREPO="reprepro" + DEVSCRIPTS="devscripts" + DEBHELPER="debhelper" + QUILT="quilt" + + apt-get -y install $REPREPO $DEVSCRIPTS $DEBHELPER $QUILT + + echo "Finised setup for xcat-dep build. Rerun this script with SETUP=0 LOCAL_KEY=1 flags" + exit 1 +fi + +# Check the necessary packages before starting the build +declare -a packages=( "reprepro" "devscripts" "debhelper" "libsoap-lite-perl" "libdbi-perl" "quilt" "git") + +for package in ${packages[@]}; do + RC=`dpkg -l | grep $package >> /dev/null 2>&1; echo $?` + if [[ ${RC} != 0 ]]; then + echo "ERROR: Could not find $package, install using 'apt-get install $package' to continue" + exit 1 + fi +done + # Supported distributions dists="saucy trusty utopic xenial bionic" @@ -136,8 +170,6 @@ function setbranch { fi } -export HOME=/root - WGET_CMD="wget" if [ ! -z ${LOG} ]; then WGET_CMD="wget -o ${LOG}" @@ -150,10 +182,16 @@ else gsa_url=http://pokgsa.ibm.com/projects/x/xcat/build/linux mkdir -p $HOME/.gnupg for key_name in pubring.gpg secring.gpg trustdb.gpg; do - if [ ! -f $HOME/.gnupg/$key_name ] || [ `wc -c $HOME/.gnupg/$key_name|cut -f 1 -d' '` == 0 ]; then - rm -f $HOME/.gnupg/$key_name - ${WGET_CMD} -P $HOME/.gnupg $gsa_url/keys/$key_name + if [ "$LOCAL_KEY" = "1" ];then + # Keys are already in the local $HOME/.gnupg directory chmod 600 $HOME/.gnupg/$key_name + else + # Need to download keys from GSA + if [ ! -f $HOME/.gnupg/$key_name ] || [ `wc -c $HOME/.gnupg/$key_name|cut -f 1 -d' '` == 0 ]; then + rm -f $HOME/.gnupg/$key_name + ${WGET_CMD} -P $HOME/.gnupg $gsa_url/keys/$key_name + chmod 600 $HOME/.gnupg/$key_name + fi fi done fi @@ -424,9 +462,8 @@ then #the path of ubuntu xcat-dep deb packages on GSA GSA="/gsa/pokgsa/projects/x/xcat/build/ubuntu/xcat-dep" - if [ ! -d $GSA ]; then - echo "build-ubunturepo: It appears that you do not have gsa installed to access the xcat-dep pkgs." + echo "build-ubunturepo: It appears that you do not have GSA to access the xcat-dep pkgs." exit 1; fi From 5b6570bd4e5ebc87a3eaa1ecf5a8757b03144c0e Mon Sep 17 00:00:00 2001 From: cxhong Date: Thu, 19 Sep 2019 09:40:31 -0400 Subject: [PATCH 14/58] Handle the bad return code if rinstall only run on one node and failed on nodeset --- xCAT-server/lib/xcat/plugins/rinstall.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/rinstall.pm b/xCAT-server/lib/xcat/plugins/rinstall.pm index 52fcc4e27..2eed25a01 100644 --- a/xCAT-server/lib/xcat/plugins/rinstall.pm +++ b/xCAT-server/lib/xcat/plugins/rinstall.pm @@ -387,6 +387,16 @@ sub rinstall { xCAT::MsgUtils->message("I", $rsp, $callback); } + # if only provision one node and failed nodeset, will exit the command + # instead of continue with rnetboot/rsetboot, rpower. + if (scalar(@nodes) == 1) { + $rsp->{error}->[0] = "Failed to run 'nodeset' against the node: @nodes"; + $rsp->{errorcode}->[0] = 1; + xCAT::MsgUtils->message("E", $rsp, $callback); + return 1; + } + + foreach my $node (@failurenodes) { delete $nodes{$node}; } From afdf1f56af47a7122c2994cd731a288dd22b67b0 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 19 Sep 2019 13:25:48 -0400 Subject: [PATCH 15/58] Mask password in logs and console output --- xCAT-server/lib/xcat/plugins/openbmc.pm | 73 +++++++++++++++++++++++-- 1 file changed, 67 insertions(+), 6 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 4b902c9c1..4ea9c859c 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -2621,6 +2621,66 @@ sub deal_with_response { #------------------------------------------------------- +=head3 mask_password2 + + return a string with masked password + + This function is usefull when password is easily known + and can be passed into this function + Input: + $string: string containing password the needs masking + $password: password to mask + +=cut + +#------------------------------------------------------- +sub mask_password2 { + + my $string = shift; + my $password = shift; + + # Replace all occurences of password string with "xxxxxx" + $string =~ s/$password/xxxxxx/g; + + return $string; +} + +#------------------------------------------------------- + +=head3 mask_password + + return a string with masked password + + This function is usefull when password is not easily known + and is only expected to be part of URL like "https://:@...." + Input: + $string: string containing password the needs masking + +=cut + +#------------------------------------------------------- +sub mask_password { + + my $string = shift; + # Replace password string with "xxxxxx", if part of URL + # Password is between ":" and "@" found in the string after "https://" + # + my $url_start = index($string,"https://"); + if ($url_start > 0) { + my $colon_index = index($string, ":", $url_start+length("https://")); + if ($colon_index > 0) { + my $at_index = index($string, "@", $colon_index); + if ($at_index > 0) { + # Replace string beteen ":" and "@" with "xxxxxx" to mask password + substr($string, $colon_index+1, $at_index-$colon_index-1) = "xxxxxx"; + } + } + } + return $string; +} + +#------------------------------------------------------- + =head3 process_debug_info print debug info and add to log @@ -2639,6 +2699,7 @@ sub process_debug_info { $debug_msg = ""; } + $debug_msg = mask_password($debug_msg); xCAT::SvrUtils::sendmsg("$flag_debug $debug_msg", $callback, $ts_node); xCAT::MsgUtils->trace(0, "D", "$flag_debug $node $debug_msg"); } @@ -4235,12 +4296,12 @@ sub dump_download_process { my $curl_login_result = `$curl_login_cmd -s`; my $h; if (!$curl_login_result) { - xCAT::SvrUtils::sendmsg([1, "Did not receive response from OpenBMC after running command '$curl_login_cmd'"], $callback, $node); + xCAT::SvrUtils::sendmsg([1, "Did not receive response from OpenBMC after running command '" . mask_password2($curl_login_cmd, $node_info{$node}{password}) . "'"], $callback, $node); return 1; } eval { $h = from_json($curl_login_result) }; if ($@) { - xCAT::SvrUtils::sendmsg([1, "Received wrong format response for command '$curl_login_cmd': $curl_login_result)"], $callback, $node); + xCAT::SvrUtils::sendmsg([1, "Received wrong format response for command '" . mask_password2($curl_login_cmd, $node_info{$node}{password}) . "': $curl_login_result)"], $callback, $node); return 1; } if ($h->{message} eq $::RESPONSE_OK) { @@ -4900,7 +4961,7 @@ sub rflash_upload { my $curl_login_result = `$curl_login_cmd -s`; my $h; if (!$curl_login_result) { - my $curl_error = "$::FAILED_UPLOAD_MSG. Did not receive response from OpenBMC after running command '$curl_login_cmd'"; + my $curl_error = "$::FAILED_UPLOAD_MSG. Did not receive response from OpenBMC after running command '" . mask_password2($curl_login_cmd, $node_info{$node}{password}) . "'"; xCAT::SvrUtils::sendmsg([1, "$curl_error"], $callback, $node); print RFLASH_LOG_FILE_HANDLE "$curl_error\n"; $node_info{$node}{rst} = "$curl_error"; @@ -4908,7 +4969,7 @@ sub rflash_upload { } eval { $h = from_json($curl_login_result) }; # convert command output to hash if ($@) { - my $curl_error = "$::FAILED_UPLOAD_MSG. Received wrong format response for command '$curl_login_cmd': $curl_login_result"; + my $curl_error = "$::FAILED_UPLOAD_MSG. Received wrong format response for command '" . mask_password2($curl_login_cmd, $node_info{$node}{password}) . "': $curl_login_result"; xCAT::SvrUtils::sendmsg([1, "$curl_error"], $callback, $node); # Before writing error to log, make it a single line $curl_error =~ tr{\n}{ }; @@ -4944,7 +5005,7 @@ sub rflash_upload { } my $curl_upload_result = `$upload_cmd`; if (!$curl_upload_result) { - my $curl_error = "$::FAILED_UPLOAD_MSG. Did not receive response from OpenBMC after running command '$upload_cmd'"; + my $curl_error = "$::FAILED_UPLOAD_MSG. Did not receive response from OpenBMC after running command '" . mask_password($upload_cmd) . "'"; xCAT::SvrUtils::sendmsg([1, "$curl_error"], $callback, $node); print RFLASH_LOG_FILE_HANDLE "$curl_error\n"; $node_info{$node}{rst} = "$curl_error"; @@ -4952,7 +5013,7 @@ sub rflash_upload { } eval { $h = from_json($curl_upload_result) }; # convert command output to hash if ($@) { - my $curl_error = "$::FAILED_UPLOAD_MSG. Received wrong format response from command '$upload_cmd': $curl_upload_result"; + my $curl_error = "$::FAILED_UPLOAD_MSG. Received wrong format response from command '" . mask_password($upload_cmd) ."': $curl_upload_result"; xCAT::SvrUtils::sendmsg([1, "$curl_error"], $callback, $node); # Before writing error to log, make it a single line $curl_error =~ tr{\n}{ }; From b79cd2dde7f0f773c63914e41636ffa82b0d6ce7 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 23 Sep 2019 17:07:17 -0400 Subject: [PATCH 16/58] Remove snapshot build info from docs --- docs/source/guides/install-guides/common_sections.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/source/guides/install-guides/common_sections.rst b/docs/source/guides/install-guides/common_sections.rst index f803deea1..4341f22f4 100644 --- a/docs/source/guides/install-guides/common_sections.rst +++ b/docs/source/guides/install-guides/common_sections.rst @@ -39,10 +39,6 @@ xCAT consists of two software packages: ``xcat-core`` and ``xcat-dep`` *This is the latest GA (Generally Availability) build that has been tested thoroughly* - * **Latest Snapshot Builds** - - *This is the latest snapshot of the GA version build that may contain bug fixes but has not yet been tested thoroughly* - * **Development Builds** *This is the snapshot builds of the new version of xCAT in development. This version has not been released yet, use as your own risk* From ef93f188b4d9ab8c8d21003762a9dd9cf67060d7 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 26 Sep 2019 10:34:43 -0400 Subject: [PATCH 17/58] OpenBMC fixes for OP940 changes --- xCAT-server/lib/xcat/plugins/openbmc.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 4ea9c859c..d406cbed9 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -205,7 +205,7 @@ my %status_info = ( }, REVENTLOG_CLEAR_REQUEST => { method => "POST", - init_url => "$openbmc_project_url/logging/action/deleteAll", + init_url => "$openbmc_project_url/logging/action/DeleteAll", data => "[]", }, REVENTLOG_CLEAR_RESPONSE => { @@ -269,7 +269,7 @@ my %status_info = ( RFLASH_SET_PRIORITY_REQUEST => { method => "PUT", init_url => "$openbmc_project_url/software", - data => "false", # Priority state of 0 sets image to active + data => "0", # Priority state of 0 sets image to active }, RFLASH_SET_PRIORITY_RESPONSE => { process => \&rflash_response, @@ -2576,9 +2576,9 @@ sub deal_with_response { # Set attribute call returned with 404, display an error $error = "$::RESPONSE_NOT_FOUND - Requested endpoint does not exist or may indicate function is not supported on this OpenBMC firmware."; } elsif ($node_info{$node}{cur_status} eq "RSPCONFIG_API_CONFIG_QUERY_RESPONSE") { - # Query attribute call came back with 404. If this is for Power Supply Redundency, + # Query attribute call came back with 404. If this is for PowerSupplyRedundancy, # send request with a new path RSPCONFIG_GET_PSR_REQUEST, response processing will print the value - if ($response_info->{'data'}->{'description'} =~ /PowerSupplyRedundancy/) { + if ($::RSPCONFIG_CONFIGURED_API_KEY eq "RSPCONFIG_POWERSUPPLY_REDUNDANCY") { $node_info{$node}{cur_status} = "RSPCONFIG_GET_PSR_REQUEST"; $next_status{RSPCONFIG_GET_PSR_REQUEST} = "RSPCONFIG_GET_PSR_RESPONSE"; gen_send_request($node); @@ -3846,7 +3846,7 @@ sub rspconfig_response { if ($node_info{$node}{cur_status} eq "RSPCONFIG_PASSWD_VERIFY") { if ($status_info{RSPCONFIG_PASSWD_VERIFY}{argv} ne $node_info{$node}{password}) { - xCAT::SvrUtils::sendmsg("Current BMC password is incorrect, cannot set the new password.", $callback, $node); + xCAT::SvrUtils::sendmsg([1, "Current BMC password is incorrect, cannot set the new password."], $callback, $node); $wait_node_num--; return; } From 6946808cad17f370303e3d5875c0bee226c0cf24 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 26 Sep 2019 15:52:13 -0400 Subject: [PATCH 18/58] OpenBMC rspconfig automated testcases --- .../testcase/UT_openbmc/rspconfig_cases0 | 169 +++++++++++++++++- 1 file changed, 165 insertions(+), 4 deletions(-) diff --git a/xCAT-test/autotest/testcase/UT_openbmc/rspconfig_cases0 b/xCAT-test/autotest/testcase/UT_openbmc/rspconfig_cases0 index d6cac63f8..a2ab9f4d9 100644 --- a/xCAT-test/autotest/testcase/UT_openbmc/rspconfig_cases0 +++ b/xCAT-test/autotest/testcase/UT_openbmc/rspconfig_cases0 @@ -1,13 +1,13 @@ start:rspconfig_record_firmware_level -description: Record the firmware level for the start of each testcase +description: Record the firmware level for the start of each testcase to display in the output hcp:openbmc label:cn_bmc_ready,hctrl_openbmc cmd: rinv $$CN firm check:rc==0 end -start:rspconfig_get_all -description: Check that we can get all the attributes from the BMC +start:rspconfig_get_all_network +description: Check that we can get all the network related attributes from the BMC os:Linux hcp:openbmc label:cn_bmc_ready,hctrl_openbmc @@ -70,7 +70,168 @@ check:output=~$$CN: BMC Setting BMC Hostname... cmd:rspconfig $$CN hostname check:rc==0 check:output=~$$CN: BMC Hostname: -cmd:rm /tmp/xcattest.rspconfig.hostname + AutoReboot check:rc==0 end +start:rspconfig_admin_passwd_error +description: Check the error handling for changing of BMC password +hcp: openbmc +label:cn_bmc_ready,hctrl_openbmc +cmd: rspconfig $$CN admin_passwd=abc +check:rc==1 +check:output=~$$CN: Error: Invalid parameter for option admin_passwd: abc +cmd: rspconfig $$CN admin_passwd=abc,xyz +check:rc==1 +check:output=~Current BMC password is incorrect, cannot set the new password. +end + +start:rspconfig_admin_passwd +description: Check the setting of BMC password to the same value +hcp: openbmc +label:cn_bmc_ready,hctrl_openbmc +cmd: rspconfig $$CN admin_passwd=0penBmc,0penBmc +check:rc==0 +check:output=~$$CN: BMC Setting Password +end + +start:rspconfig_autoreboot +description: Check the getting and setting of autoreboot attribute +hcp: openbmc +label:cn_bmc_ready,hctrl_openbmc +cmd: rspconfig $$CN autoreboot +check:rc==0 +check:output=~$$CN: BMC AutoReboot +cmd: rspconfig $$CN autoreboot=0 +check:rc==0 +check:output=~$$CN: BMC Setting BMC AutoReboot +cmd: rspconfig $$CN autoreboot=1 +check:rc==0 +check:output=~$$CN: BMC Setting BMC AutoReboot +cmd: rspconfig $$CN autoreboot= +check:rc==1 +check:output=~$$CN: Error: Invalid value '' for 'autoreboot', Valid values: 0,1 +cmd: rspconfig $$CN autoreboot=2 +check:rc==1 +check:output=~$$CN: Error: Invalid value '2' for 'autoreboot', Valid values: 0,1 +end + +start:rspconfig_bootmode +description: Check the getting and setting of bootmode attribute +hcp: openbmc +label:cn_bmc_ready,hctrl_openbmc +cmd: rspconfig $$CN bootmode=safe +check:rc==0 +check:output=~$$CN: BMC Setting BMC BootMode +cmd: rspconfig $$CN bootmode +check:rc==0 +check:output=~$$CN: BMC BootMode: Safe +cmd: rspconfig $$CN bootmode=regular +check:rc==0 +check:output=~$$CN: BMC Setting BMC BootMode +cmd: rspconfig $$CN bootmode=abc +check:rc==1 +check:output=~$$CN: Error: Invalid value 'abc' for 'bootmode', Valid values: regular,safe,setup +end + +start:rspconfig_dump +description: Check dump generation, download and removal +hcp: openbmc +label:cn_bmc_ready,hctrl_openbmc +#Clear old dumps for this node +cmd: rm -f /var/log/xcat/dump/*_$$CN_dump_* +#Generate new dump +cmd: rspconfig $$CN dump +check:rc==0 +check:output=~Capturing BMC Diagnostic information, this will take some time +check:output=~$$CN Dump requested. Target ID is +check:output=~Downloading dump +#Verify dump was downloaded to proper directory +cmd: ls -l /var/log/xcat/dump/*_$$CN_dump_* +check:rc==0 +#Remove last generated dump +cmd: rspconfig mid05tor12cn03 dump -l | tail -1 | cut -d ' ' -f2 | tr -d "[]" | xargs -i{} rspconfig $$CN dump -c {} +check:rc==0 +check:output=clear +end + +start:rspconfig_ntpservers +description: Check the getting and setting of ntpservers attribute +hcp: openbmc +label:cn_bmc_ready,hctrl_openbmc +cmd: rspconfig $$CN ntpservers +check:rc==0 +check:output=~$$CN: BMC NTP Servers +cmd: rspconfig $$CN ntpservers=1.1.1.1 +check:rc==0 +check:output=~$$CN: BMC NTP Servers: 1.1.1.1 +cmd: rspconfig $$CN ntpservers= +check:rc==0 +check:output=~$$CN: BMC NTP Servers: None +end + +start:rspconfig_powerrestorepolicy +description: Check the getting and setting of powerrestorepolicy attribute +hcp: openbmc +label:cn_bmc_ready,hctrl_openbmc +cmd: rspconfig $$CN powerrestorepolicy +check:rc==0 +check:output=~$$CN: BMC PowerRestorePolicy +cmd: rspconfig $$CN powerrestorepolicy=always_on +check:rc==0 +check:output=~$$CN: BMC Setting BMC PowerRestorePolicy +cmd: rspconfig $$CN powerrestorepolicy=always_off +check:rc==0 +check:output=~$$CN: BMC Setting BMC PowerRestorePolicy +cmd: rspconfig $$CN powerrestorepolicy=restore +check:rc==0 +check:output=~$$CN: BMC Setting BMC PowerRestorePolicy +cmd: rspconfig $$CN powerrestorepolicy +check:rc==0 +check:output=~$$CN: BMC PowerRestorePolicy: Restore +cmd: rspconfig $$CN powerrestorepolicy= +check:rc==1 +check:output=~$$CN: Error: Invalid value '' for 'powerrestorepolicy', Valid values: always_off,always_on,restore +cmd: rspconfig $$CN powerrestorepolicy=abc +check:rc==1 +check:output=~$$CN: Error: Invalid value 'abc' for 'powerrestorepolicy', Valid values: always_off,always_on,restore +end + +start:rspconfig_powersupplyredundancy +description: Check the getting and setting of powersupplyredundancy attribute +hcp: openbmc +label:cn_bmc_ready,hctrl_openbmc +cmd: rspconfig $$CN powersupplyredundancy=disabled +check:rc==1 +check:output=~Error: 404 Not Found - Requested endpoint does not exist or may indicate function is not supported on this OpenBMC firmware. +cmd: rspconfig $$CN powersupplyredundancy +check:rc==0 +check:output=~$$CN: BMC PowerSupplyRedundancy: Disabled +end + +start:rspconfig_sshcfg +description: Check the copying of ssh keys to the BMC +hcp: openbmc +label:cn_bmc_ready,hctrl_openbmc +cmd: rspconfig $$CN sshcfg +check:rc==0 +check:output=~$$CN: ssh keys copied to +end + +start:rspconfig_timesyncmethod +description: Check the getting and setting of timesyncmethod attribute +hcp: openbmc +label:cn_bmc_ready,hctrl_openbmc +cmd: rspconfig $$CN timesyncmethod=manual +check:rc==0 +check:output=~$$CN: BMC Setting BMC TimeSyncMethod +cmd: rspconfig $$CN timesyncmethod +check:rc==0 +check:output=~$$CN: BMC TimeSyncMethod: Manual +cmd: rspconfig $$CN timesyncmethod=ntp +check:rc==0 +check:output=~$$CN: BMC Setting BMC TimeSyncMethod +cmd: rspconfig $$CN timesyncmethod=abc +check:rc==1 +check:output=~$$CN: Error: Invalid value 'abc' for 'timesyncmethod', Valid values: manual,ntp +end From 35d0728550814c51532649b1c10aefbe19f7fec8 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 26 Sep 2019 16:06:46 -0400 Subject: [PATCH 19/58] Remove old debug statements --- xCAT-server/lib/xcat/plugins/kvm.pm | 9 --------- 1 file changed, 9 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index c46d0553a..02fb6e385 100755 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -49,7 +49,6 @@ if (Sys::Virt->VERSION =~ /^0\.[10]\./) { use XML::Simple; $XML::Simple::PREFERRED_PARSER = 'XML::Parser'; -use Data::Dumper; use POSIX "WNOHANG"; use Storable qw(freeze thaw store_fd fd_retrieve); use IO::Select; @@ -3887,20 +3886,12 @@ sub process_request { $confdata = {}; unless ($command eq 'rscan') { xCAT::VMCommon::grab_table_data($noderange, $confdata, $callback); - # Add debug info for issue 1958, the rmvm issue - my $test_file_fd; - open($test_file_fd, ">> $::XCATROOT//share/xcat/tools/autotest/result/$command.$$.rec"); - print $test_file_fd "====================start==========================\n"; my $kvmdatatab = xCAT::Table->new("kvm_nodedata", -create => 0); #grab any pertinent pre-existing xml if ($kvmdatatab) { $confdata->{kvmnodedata} = $kvmdatatab->getNodesAttribs($noderange, [qw/xml/]); - print $test_file_fd Dumper($confdata->{kvmnodedata}); } else { $confdata->{kvmnodedata} = {}; - print $test_file_fd "***Error: Can not open kvm_nodedata table==\n"; } - print $test_file_fd "====================end==========================\n"; - close $test_file_fd; } if ($command eq 'mkvm' or ($command eq 'clonevm' and (grep { "$_" eq '-b' } @exargs)) or ($command eq 'rpower' and (grep { "$_" eq "on" or $_ eq "boot" or $_ eq "reset" } @exargs))) { xCAT::VMCommon::requestMacAddresses($confdata, $noderange); From 796104ac209172724b58addd344e20738efb7f41 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 27 Sep 2019 12:13:31 -0400 Subject: [PATCH 20/58] Fix rspconfig dump testcase --- xCAT-test/autotest/testcase/UT_openbmc/rspconfig_cases0 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xCAT-test/autotest/testcase/UT_openbmc/rspconfig_cases0 b/xCAT-test/autotest/testcase/UT_openbmc/rspconfig_cases0 index a2ab9f4d9..9f7fc6ef1 100644 --- a/xCAT-test/autotest/testcase/UT_openbmc/rspconfig_cases0 +++ b/xCAT-test/autotest/testcase/UT_openbmc/rspconfig_cases0 @@ -139,15 +139,15 @@ description: Check dump generation, download and removal hcp: openbmc label:cn_bmc_ready,hctrl_openbmc #Clear old dumps for this node -cmd: rm -f /var/log/xcat/dump/*_$$CN_dump_* +cmd: rm -f /var/log/xcat/dump/*$$CN* #Generate new dump cmd: rspconfig $$CN dump check:rc==0 check:output=~Capturing BMC Diagnostic information, this will take some time -check:output=~$$CN Dump requested. Target ID is +check:output=~$$CN: Dump requested. Target ID is check:output=~Downloading dump #Verify dump was downloaded to proper directory -cmd: ls -l /var/log/xcat/dump/*_$$CN_dump_* +cmd: ls -l /var/log/xcat/dump/*$$CN* check:rc==0 #Remove last generated dump cmd: rspconfig mid05tor12cn03 dump -l | tail -1 | cut -d ' ' -f2 | tr -d "[]" | xargs -i{} rspconfig $$CN dump -c {} From 7cdd187fb0636e7efc9529c542252dd82bf51dc2 Mon Sep 17 00:00:00 2001 From: Oriol Mula-Valls Date: Thu, 3 Oct 2019 09:18:11 +0200 Subject: [PATCH 21/58] Replace init.d calls with systemd ones --- xCAT-server/lib/xcat/monitoring/gangliamon.pm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/xCAT-server/lib/xcat/monitoring/gangliamon.pm b/xCAT-server/lib/xcat/monitoring/gangliamon.pm index fef33ff13..dd350d794 100755 --- a/xCAT-server/lib/xcat/monitoring/gangliamon.pm +++ b/xCAT-server/lib/xcat/monitoring/gangliamon.pm @@ -65,7 +65,7 @@ sub start { if ($OS =~ /AIX/) { $res_gmond = `/etc/rc.d/init.d/gmond restart 2>&1`; } else { - $res_gmond = `/etc/init.d/gmond restart 2>&1`; + $res_gmond = `systemctl restart gmond 2>&1`; } my $tmp; @@ -90,9 +90,9 @@ sub start { $res_gmetad = `/etc/rc.d/init.d/gmetad restart 2>&1`; } } else { - $tmp = `/etc/init.d/gmetad status | grep running`; + $tmp = `systemctl status gmetad| grep running`; if (!$tmp) { - $res_gmetad = `/etc/init.d/gmetad restart 2>&1`; + $res_gmetad = `systemctl restart gmetad 2>&1`; } } @@ -166,7 +166,7 @@ sub start { $result = `XCATBYPASS=Y $::XCATROOT/bin/xdsh $rec /etc/rc.d/init.d/gmond restart 2>&1`; } else { - $result = `XCATBYPASS=Y $::XCATROOT/bin/xdsh $rec /etc/init.d/gmond restart 2>&1`; + $result = `XCATBYPASS=Y $::XCATROOT/bin/xdsh $rec systemctl restart gmond 2>&1`; } } @@ -787,7 +787,7 @@ sub stop { if ($OS =~ /AIX/) { $res_gmond = `/etc/rc.d/init.d/gmond stop 2>&1`; } else { - $res_gmond = `/etc/init.d/gmond stop 2>&1`; + $res_gmond = `systemctl stop gmond 2>&1`; } if ($?) { if ($callback) { @@ -805,7 +805,7 @@ sub stop { if ($OS =~ /AIX/) { $res_gmetad = `/etc/rc.d/init.d/gmetad stop 2>&1`; } else { - $res_gmetad = `/etc/init.d/gmetad stop 2>&1`; + $res_gmetad = `systemctl stop gmetad 2>&1`; } if ($?) { @@ -867,7 +867,7 @@ sub stop { if ($OS =~ /AIX/) { $result = `XCATBYPASS=Y $::XCATROOT/bin/xdsh $rec /etc/rc.d/init.d/gmond stop 2>&1`; } else { - $result = `XCATBYPASS=Y $::XCATROOT/bin/xdsh $rec /etc/init.d/gmond stop 2>&1`; + $result = `XCATBYPASS=Y $::XCATROOT/bin/xdsh $rec systemctl stop gmond 2>&1`; } } From 3ab23a6d86ed6a8f86e1f817f210607dcdd4789c Mon Sep 17 00:00:00 2001 From: Oriol Mula-Valls Date: Thu, 3 Oct 2019 09:21:02 +0200 Subject: [PATCH 22/58] Fix indent, automatic generation of default configuration, simplified code --- xCAT/postscripts/confGang | 140 +++++++++----------------------------- 1 file changed, 32 insertions(+), 108 deletions(-) diff --git a/xCAT/postscripts/confGang b/xCAT/postscripts/confGang index 13ce7cfe4..5be4e780f 100755 --- a/xCAT/postscripts/confGang +++ b/xCAT/postscripts/confGang @@ -1,24 +1,24 @@ #!/bin/sh #get IP address of MS -OS=`uname` +OS=$(uname) echo "the OS is $OS" logger -t xcat -p local4.info "the OS is $OS" ms_ip=$MONMASTER echo "MS IP is $ms_ip" logger -t xcat -p local4.info "the MS is $ms_ip" -result=`ping -c1 $MONMASTER 2>&1` - if [ $? -eq 0 ]; then - index1=`expr index "$result" "\("` - index2=`expr index "$result" "\)"` - #ms_ip=${result:$index1+1:$index2-$index1-2} - pos=`expr $index1 + 1` - length=`expr $index2 - $index1` - length=`expr $length - 1` - ms_ip=`expr substr "$result" $pos $length` - echo final is $ms_ip - else - logger -t xcat -p local4.info "Gangliamon setup" - fi +result=$(ping -c1 $MONMASTER 2>&1) +if [ $? -eq 0 ]; then + index1=$(expr index "$result" "\(") + index2=$(expr index "$result" "\)") + #ms_ip=${result:$index1+1:$index2-$index1-2} + pos=$(expr $index1 + 1) + length=$(expr $index2 - $index1) + length=$(expr $length - 1) + ms_ip=$(expr substr "$result" $pos $length) + echo final is $ms_ip +else + logger -t xcat -p local4.info "Gangliamon setup" +fi CLUSTER=\"$MONSERVER\" echo "cluster is $CLUSTER" @@ -26,102 +26,26 @@ logger -t xcat -p local4.info "cluster is $CLUSTER" MASTER=$ms_ip #echo "The new IP is: $NEW_IP" #echo "I will replace now.... -gmond_conf="/etc/ganglia/gmond.conf" -gmond_conf_old="/etc/gmond.conf" +gmond_conf=$(gmond --help|grep -Eo "[a-z/]+/gmond.conf") +gmond_version=$(gmond -V|cut -d" " -f2) - if [ $OS == "AIX" ]; then - echo "into AIX loop" - logger -t xcat -p local4.info "into AIX loop" - if [ -f $gmond_conf_old ]; then - echo "ganglia version 3.0.7" - logger -t xcat -p local4.info "ganglia version 3.0.7" - grep "xCAT gmond settings done" $gmond_conf_old - if [ $? -gt 0 ]; then - /bin/cp -f $gmond_conf_old /etc/gmond.conf.orig - sed -e "s/setuid = yes/setuid = no/1" $gmond_conf_old > /etc/gmond.conf1 - sed -e 's/name = "unspecified"/name='$CLUSTER'/1' /etc/gmond.conf1 > /etc/gmond.conf2 - sed -e "1,40s/mcast_join = .*/host = $MASTER/" /etc/gmond.conf2 > /etc/gmond.conf3 - sed -e 's/mcast_join/#/g' /etc/gmond.conf3 > /etc/gmond.conf4 - sed -e "s/bind/#/g" /etc/gmond.conf4 > /etc/gmond.conf5 - /bin/cp -f /etc/gmond.conf5 $gmond_conf_old - rm -f /etc/gmond.conf1 /etc/gmond.conf2 /etc/gmond.conf3 /etc/gmond.conf4 /etc/gmond.conf5 - echo "# xCAT gmond settings done sh" >> $gmond_conf_old - fi - fi - fi - - - if [ $OS == "AIX" ]; then - echo "into AIX new loop" - logger -t xcat -p local4.info "into AIX new loop" - if [ -f $gmond_conf ]; then - echo "ganglia version v3.10" - logger -t xcat -p local4.info "ganglia version v3.10" - grep "xCAT gmond settings done" $gmond_conf - if [ $? -gt 0 ]; then - /bin/cp -f $gmond_conf /etc/ganglia/gmond.conf.orig - sed -e "s/setuid = yes/setuid = no/1" $gmond_conf > /etc/ganglia/gmond.conf1 - sed -e 's/name = "unspecified"/name='$CLUSTER'/1' /etc/ganglia/gmond.conf1 > /etc/ganglia/gmond.conf2 - sed -e "1,40s/mcast_join = .*/host = $MASTER/" /etc/ganglia/gmond.conf2 > /etc/ganglia/gmond.conf3 - sed -e 's/mcast_join/#/g' /etc/ganglia/gmond.conf3 > /etc/ganglia/gmond.conf4 - sed -e "s/bind/#/g" /etc/ganglia/gmond.conf4 > /etc/ganglia/gmond.conf5 - /bin/cp -f /etc/ganglia/gmond.conf5 $gmond_conf - rm -f /etc/ganglia/gmond.conf1 /etc/ganglia/gmond.conf2 /etc/ganglia/gmond.conf3 /etc/ganglia/gmond.conf4 /etc/ganglia/gmond.conf5 - echo "# xCAT gmond settings done sh" >> $gmond_conf - fi - fi - fi - - - - - - if [ $OS != "AIX" ]; then - echo "not AIX" - logger -t xcat -p local4.info "not AIX" - if [ -f $gmond_conf ]; then - grep "xCAT gmond settings done" $gmond_conf - if [ $? -gt 0 ]; then - /bin/cp -f $gmond_conf /etc/ganglia/gmond.conf.orig - sed -i 's/setuid = yes/setuid = no/1' $gmond_conf - sed -i 's/name = "unspecified"/name='$CLUSTER'/1' $gmond_conf - sed -e "1,50s/^ *mcast_join = .*/host = $MASTER/" $gmond_conf > /etc/temp.conf - /bin/cp -f /etc/temp.conf $gmond_conf - sed -i 's/^ *mcast_join/#mcast_join/g' $gmond_conf - sed -i 's/^ *bind/#bind/g' $gmond_conf - echo "# xCAT gmond settings done sh" >> $gmond_conf - fi - fi - fi - - - if [ $OS != "AIX" ]; then - echo "not AIX" - logger -t xcat -p local4.info "not AIX" - - if [ -f $gmond_conf_old ]; then - grep "xCAT gmond settings done" $gmond_conf_old - if [ $? -gt 0 ]; then - /bin/cp -f $gmond_conf_old /etc/gmond.conf.orig - sed -i 's/setuid = yes/setuid = no/1' $gmond_conf_old - sed -i 's/name = "unspecified"/name='$CLUSTER'/1' $gmond_conf_old - sed -e "1,40s/mcast_join = .*/host = $MASTER/" $gmond_conf_old > /etc/temp.conf - /bin/cp -f /etc/temp.conf $gmond_conf_old - sed -i 's/mcast_join/#/g' $gmond_conf_old - sed -i 's/bind/#/g' $gmond_conf_old - echo "# xCAT gmond settings done sh_old" >> $gmond_conf_old - fi - fi +if [ ! -f $gmond_conf ]; then + # echo "file not found" + logger -t xcat -p local4.warning "gmond configuration file not found. Generating a default one" + gmond -t > ${gmond_conf} fi - if [ ! -f $gmond_conf ]; then - # echo "file not found" - logger -t xcat -p local4.warning "gmond configuration file not found" - fi - - if [ ! -f $gmond_conf_old ]; then - # echo "file not found" - logger -t xcat -p local4.warning "gmond configuration file not found" - fi +echo "ganglia version ${gmond_version}" +logger -t xcat -p local4.info "ganglia version ${gmond_version}" +grep "xCAT gmond settings done" $gmond_conf +if [ $? -gt 0 ]; then + /bin/cp -f $gmond_conf /etc/ganglia/gmond.conf.orig + sed -i -e "s/setuid = yes/setuid = no/1" ${gmond_conf} + sed -i -e 's/name = "unspecified"/name='$CLUSTER'/1' ${gmond_conf} + sed -i -e "1,40s/mcast_join = .*/host = $MASTER/" ${gmond_conf} + sed -i -e '/mcast_join/d' ${gmond_conf} + sed -i -e "/\s\+bind/d" ${gmond_conf} + echo "# xCAT gmond settings done sh" >> $gmond_conf +fi exit 0 From 806feb006a3c439cd561520598f324a240ce05eb Mon Sep 17 00:00:00 2001 From: Oriol Mula-Valls Date: Thu, 3 Oct 2019 09:18:11 +0200 Subject: [PATCH 23/58] Replace init.d calls with systemd ones --- xCAT-server/lib/xcat/monitoring/gangliamon.pm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/xCAT-server/lib/xcat/monitoring/gangliamon.pm b/xCAT-server/lib/xcat/monitoring/gangliamon.pm index fef33ff13..dd350d794 100755 --- a/xCAT-server/lib/xcat/monitoring/gangliamon.pm +++ b/xCAT-server/lib/xcat/monitoring/gangliamon.pm @@ -65,7 +65,7 @@ sub start { if ($OS =~ /AIX/) { $res_gmond = `/etc/rc.d/init.d/gmond restart 2>&1`; } else { - $res_gmond = `/etc/init.d/gmond restart 2>&1`; + $res_gmond = `systemctl restart gmond 2>&1`; } my $tmp; @@ -90,9 +90,9 @@ sub start { $res_gmetad = `/etc/rc.d/init.d/gmetad restart 2>&1`; } } else { - $tmp = `/etc/init.d/gmetad status | grep running`; + $tmp = `systemctl status gmetad| grep running`; if (!$tmp) { - $res_gmetad = `/etc/init.d/gmetad restart 2>&1`; + $res_gmetad = `systemctl restart gmetad 2>&1`; } } @@ -166,7 +166,7 @@ sub start { $result = `XCATBYPASS=Y $::XCATROOT/bin/xdsh $rec /etc/rc.d/init.d/gmond restart 2>&1`; } else { - $result = `XCATBYPASS=Y $::XCATROOT/bin/xdsh $rec /etc/init.d/gmond restart 2>&1`; + $result = `XCATBYPASS=Y $::XCATROOT/bin/xdsh $rec systemctl restart gmond 2>&1`; } } @@ -787,7 +787,7 @@ sub stop { if ($OS =~ /AIX/) { $res_gmond = `/etc/rc.d/init.d/gmond stop 2>&1`; } else { - $res_gmond = `/etc/init.d/gmond stop 2>&1`; + $res_gmond = `systemctl stop gmond 2>&1`; } if ($?) { if ($callback) { @@ -805,7 +805,7 @@ sub stop { if ($OS =~ /AIX/) { $res_gmetad = `/etc/rc.d/init.d/gmetad stop 2>&1`; } else { - $res_gmetad = `/etc/init.d/gmetad stop 2>&1`; + $res_gmetad = `systemctl stop gmetad 2>&1`; } if ($?) { @@ -867,7 +867,7 @@ sub stop { if ($OS =~ /AIX/) { $result = `XCATBYPASS=Y $::XCATROOT/bin/xdsh $rec /etc/rc.d/init.d/gmond stop 2>&1`; } else { - $result = `XCATBYPASS=Y $::XCATROOT/bin/xdsh $rec /etc/init.d/gmond stop 2>&1`; + $result = `XCATBYPASS=Y $::XCATROOT/bin/xdsh $rec systemctl stop gmond 2>&1`; } } From 5506a9e79b323e83a7272ff0497ef72b74d49496 Mon Sep 17 00:00:00 2001 From: Oriol Mula-Valls Date: Thu, 3 Oct 2019 09:21:02 +0200 Subject: [PATCH 24/58] Fix indent, automatic generation of default configuration, simplified code --- xCAT/postscripts/confGang | 140 +++++++++----------------------------- 1 file changed, 32 insertions(+), 108 deletions(-) diff --git a/xCAT/postscripts/confGang b/xCAT/postscripts/confGang index 13ce7cfe4..5be4e780f 100755 --- a/xCAT/postscripts/confGang +++ b/xCAT/postscripts/confGang @@ -1,24 +1,24 @@ #!/bin/sh #get IP address of MS -OS=`uname` +OS=$(uname) echo "the OS is $OS" logger -t xcat -p local4.info "the OS is $OS" ms_ip=$MONMASTER echo "MS IP is $ms_ip" logger -t xcat -p local4.info "the MS is $ms_ip" -result=`ping -c1 $MONMASTER 2>&1` - if [ $? -eq 0 ]; then - index1=`expr index "$result" "\("` - index2=`expr index "$result" "\)"` - #ms_ip=${result:$index1+1:$index2-$index1-2} - pos=`expr $index1 + 1` - length=`expr $index2 - $index1` - length=`expr $length - 1` - ms_ip=`expr substr "$result" $pos $length` - echo final is $ms_ip - else - logger -t xcat -p local4.info "Gangliamon setup" - fi +result=$(ping -c1 $MONMASTER 2>&1) +if [ $? -eq 0 ]; then + index1=$(expr index "$result" "\(") + index2=$(expr index "$result" "\)") + #ms_ip=${result:$index1+1:$index2-$index1-2} + pos=$(expr $index1 + 1) + length=$(expr $index2 - $index1) + length=$(expr $length - 1) + ms_ip=$(expr substr "$result" $pos $length) + echo final is $ms_ip +else + logger -t xcat -p local4.info "Gangliamon setup" +fi CLUSTER=\"$MONSERVER\" echo "cluster is $CLUSTER" @@ -26,102 +26,26 @@ logger -t xcat -p local4.info "cluster is $CLUSTER" MASTER=$ms_ip #echo "The new IP is: $NEW_IP" #echo "I will replace now.... -gmond_conf="/etc/ganglia/gmond.conf" -gmond_conf_old="/etc/gmond.conf" +gmond_conf=$(gmond --help|grep -Eo "[a-z/]+/gmond.conf") +gmond_version=$(gmond -V|cut -d" " -f2) - if [ $OS == "AIX" ]; then - echo "into AIX loop" - logger -t xcat -p local4.info "into AIX loop" - if [ -f $gmond_conf_old ]; then - echo "ganglia version 3.0.7" - logger -t xcat -p local4.info "ganglia version 3.0.7" - grep "xCAT gmond settings done" $gmond_conf_old - if [ $? -gt 0 ]; then - /bin/cp -f $gmond_conf_old /etc/gmond.conf.orig - sed -e "s/setuid = yes/setuid = no/1" $gmond_conf_old > /etc/gmond.conf1 - sed -e 's/name = "unspecified"/name='$CLUSTER'/1' /etc/gmond.conf1 > /etc/gmond.conf2 - sed -e "1,40s/mcast_join = .*/host = $MASTER/" /etc/gmond.conf2 > /etc/gmond.conf3 - sed -e 's/mcast_join/#/g' /etc/gmond.conf3 > /etc/gmond.conf4 - sed -e "s/bind/#/g" /etc/gmond.conf4 > /etc/gmond.conf5 - /bin/cp -f /etc/gmond.conf5 $gmond_conf_old - rm -f /etc/gmond.conf1 /etc/gmond.conf2 /etc/gmond.conf3 /etc/gmond.conf4 /etc/gmond.conf5 - echo "# xCAT gmond settings done sh" >> $gmond_conf_old - fi - fi - fi - - - if [ $OS == "AIX" ]; then - echo "into AIX new loop" - logger -t xcat -p local4.info "into AIX new loop" - if [ -f $gmond_conf ]; then - echo "ganglia version v3.10" - logger -t xcat -p local4.info "ganglia version v3.10" - grep "xCAT gmond settings done" $gmond_conf - if [ $? -gt 0 ]; then - /bin/cp -f $gmond_conf /etc/ganglia/gmond.conf.orig - sed -e "s/setuid = yes/setuid = no/1" $gmond_conf > /etc/ganglia/gmond.conf1 - sed -e 's/name = "unspecified"/name='$CLUSTER'/1' /etc/ganglia/gmond.conf1 > /etc/ganglia/gmond.conf2 - sed -e "1,40s/mcast_join = .*/host = $MASTER/" /etc/ganglia/gmond.conf2 > /etc/ganglia/gmond.conf3 - sed -e 's/mcast_join/#/g' /etc/ganglia/gmond.conf3 > /etc/ganglia/gmond.conf4 - sed -e "s/bind/#/g" /etc/ganglia/gmond.conf4 > /etc/ganglia/gmond.conf5 - /bin/cp -f /etc/ganglia/gmond.conf5 $gmond_conf - rm -f /etc/ganglia/gmond.conf1 /etc/ganglia/gmond.conf2 /etc/ganglia/gmond.conf3 /etc/ganglia/gmond.conf4 /etc/ganglia/gmond.conf5 - echo "# xCAT gmond settings done sh" >> $gmond_conf - fi - fi - fi - - - - - - if [ $OS != "AIX" ]; then - echo "not AIX" - logger -t xcat -p local4.info "not AIX" - if [ -f $gmond_conf ]; then - grep "xCAT gmond settings done" $gmond_conf - if [ $? -gt 0 ]; then - /bin/cp -f $gmond_conf /etc/ganglia/gmond.conf.orig - sed -i 's/setuid = yes/setuid = no/1' $gmond_conf - sed -i 's/name = "unspecified"/name='$CLUSTER'/1' $gmond_conf - sed -e "1,50s/^ *mcast_join = .*/host = $MASTER/" $gmond_conf > /etc/temp.conf - /bin/cp -f /etc/temp.conf $gmond_conf - sed -i 's/^ *mcast_join/#mcast_join/g' $gmond_conf - sed -i 's/^ *bind/#bind/g' $gmond_conf - echo "# xCAT gmond settings done sh" >> $gmond_conf - fi - fi - fi - - - if [ $OS != "AIX" ]; then - echo "not AIX" - logger -t xcat -p local4.info "not AIX" - - if [ -f $gmond_conf_old ]; then - grep "xCAT gmond settings done" $gmond_conf_old - if [ $? -gt 0 ]; then - /bin/cp -f $gmond_conf_old /etc/gmond.conf.orig - sed -i 's/setuid = yes/setuid = no/1' $gmond_conf_old - sed -i 's/name = "unspecified"/name='$CLUSTER'/1' $gmond_conf_old - sed -e "1,40s/mcast_join = .*/host = $MASTER/" $gmond_conf_old > /etc/temp.conf - /bin/cp -f /etc/temp.conf $gmond_conf_old - sed -i 's/mcast_join/#/g' $gmond_conf_old - sed -i 's/bind/#/g' $gmond_conf_old - echo "# xCAT gmond settings done sh_old" >> $gmond_conf_old - fi - fi +if [ ! -f $gmond_conf ]; then + # echo "file not found" + logger -t xcat -p local4.warning "gmond configuration file not found. Generating a default one" + gmond -t > ${gmond_conf} fi - if [ ! -f $gmond_conf ]; then - # echo "file not found" - logger -t xcat -p local4.warning "gmond configuration file not found" - fi - - if [ ! -f $gmond_conf_old ]; then - # echo "file not found" - logger -t xcat -p local4.warning "gmond configuration file not found" - fi +echo "ganglia version ${gmond_version}" +logger -t xcat -p local4.info "ganglia version ${gmond_version}" +grep "xCAT gmond settings done" $gmond_conf +if [ $? -gt 0 ]; then + /bin/cp -f $gmond_conf /etc/ganglia/gmond.conf.orig + sed -i -e "s/setuid = yes/setuid = no/1" ${gmond_conf} + sed -i -e 's/name = "unspecified"/name='$CLUSTER'/1' ${gmond_conf} + sed -i -e "1,40s/mcast_join = .*/host = $MASTER/" ${gmond_conf} + sed -i -e '/mcast_join/d' ${gmond_conf} + sed -i -e "/\s\+bind/d" ${gmond_conf} + echo "# xCAT gmond settings done sh" >> $gmond_conf +fi exit 0 From 4eef7d6987ada430d7a8d0c226005771f124f560 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 3 Oct 2019 11:28:51 -0400 Subject: [PATCH 25/58] Revert "Remove kits from Ubuntu and go-xcat" This reverts commit 7c9d6a56f00d744752ae3ec4d2eac5515e1ef490. --- xCAT-server/share/xcat/tools/go-xcat | 6 +++--- xCAT/debian/control | 2 +- xCATsn/debian/control | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index 4d128fe88..290916800 100755 --- a/xCAT-server/share/xcat/tools/go-xcat +++ b/xCAT-server/share/xcat/tools/go-xcat @@ -167,13 +167,13 @@ GO_XCAT_CORE_PACKAGE_LIST=() GO_XCAT_DEP_PACKAGE_LIST=() # The package list of all the packages should be installed -GO_XCAT_INSTALL_LIST=(perl-xCAT xCAT xCAT-client +GO_XCAT_INSTALL_LIST=(perl-xCAT xCAT xCAT-buildkit xCAT-client xCAT-genesis-scripts-ppc64 xCAT-genesis-scripts-x86_64 xCAT-server elilo-xcat grub2-xcat ipmitool-xcat syslinux-xcat xCAT-genesis-base-ppc64 xCAT-genesis-base-x86_64 xnba-undi yaboot-xcat) -# For Debian/Ubuntu, it will need a sightly different package list +# For Debian/Ubuntu, it will need a sight different package list type dpkg >/dev/null 2>&1 && -GO_XCAT_INSTALL_LIST=(perl-xcat xcat xcat-client +GO_XCAT_INSTALL_LIST=(perl-xcat xcat xcat-buildkit xcat-client xcat-genesis-scripts-amd64 xcat-genesis-scripts-ppc64 xcat-server elilo-xcat grub2-xcat ipmitool-xcat syslinux-xcat xcat-genesis-base-amd64 xcat-genesis-base-ppc64 xnba-undi) diff --git a/xCAT/debian/control b/xCAT/debian/control index fe5b7c758..4b3fedcc3 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, 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-probe (>= 2.13-snap000000000000) +Recommends: bind9, nmap, tftp-hpa, ipmitool-xcat (>= 1.8.17-1), syslinux[any-amd64], libsys-virt-perl, syslinux-xcat, xnba-undi, elilo-xcat, xcat-buildkit (>= 2.13-snap000000000000), xcat-probe (>= 2.13-snap000000000000) Suggests: yaboot-xcat Description: Metapackage for a common, default xCAT setup xCAT is Extreme Cluster/Cloud Administration Toolkit. xCAT offers complete diff --git a/xCATsn/debian/control b/xCATsn/debian/control index eaca013f9..3476c39c0 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, 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-probe (>= 2.13-snap000000000000) +Recommends: bind9, nmap, tftp-hpa, ipmitool-xcat (>= 1.8.17-1), syslinux[any-amd64], libsys-virt-perl, syslinux-xcat, xnba-undi, elilo-xcat, xcat-buildkit (>= 2.13-snap000000000000), xcat-probe (>= 2.13-snap000000000000) Suggests: yaboot-xcat Description: Metapackage for a common, default xCAT service node setup xCATsn is a service node management package intended for at-scale From 7346de78c6b421e8fb3365550f945d18baa9b49f Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 3 Oct 2019 11:45:18 -0400 Subject: [PATCH 26/58] Revert "Remove man pages for kit related commands" This reverts commit 36116078ac40b282865f06246ee09ebffe475b8f. --- .../admin-guides/references/man1/addkit.1.rst | 137 +++++++ .../references/man1/addkitcomp.1.rst | 154 ++++++++ .../references/man1/buildkit.1.rst | 372 ++++++++++++++++++ .../references/man1/chkkitcomp.1.rst | 106 +++++ .../admin-guides/references/man1/lskit.1.rst | 250 ++++++++++++ .../references/man1/lskitcomp.1.rst | 247 ++++++++++++ .../references/man1/lskitdeployparam.1.rst | 162 ++++++++ .../admin-guides/references/man1/rmkit.1.rst | 151 +++++++ .../references/man1/rmkitcomp.1.rst | 162 ++++++++ xCAT-buildkit/pods/man1/buildkit.1.pod | 285 ++++++++++++++ xCAT-client/pods/man1/addkit.1.pod | 79 ++++ xCAT-client/pods/man1/addkitcomp.1.pod | 90 +++++ xCAT-client/pods/man1/chkkitcomp.1.pod | 61 +++ xCAT-client/pods/man1/lskit.1.pod | 168 ++++++++ xCAT-client/pods/man1/lskitcomp.1.pod | 156 ++++++++ xCAT-client/pods/man1/lskitdeployparam.1.pod | 107 +++++ xCAT-client/pods/man1/rmkit.1.pod | 83 ++++ xCAT-client/pods/man1/rmkitcomp.1.pod | 90 +++++ 18 files changed, 2860 insertions(+) create mode 100644 docs/source/guides/admin-guides/references/man1/addkit.1.rst create mode 100644 docs/source/guides/admin-guides/references/man1/addkitcomp.1.rst create mode 100644 docs/source/guides/admin-guides/references/man1/buildkit.1.rst create mode 100644 docs/source/guides/admin-guides/references/man1/chkkitcomp.1.rst create mode 100644 docs/source/guides/admin-guides/references/man1/lskit.1.rst create mode 100644 docs/source/guides/admin-guides/references/man1/lskitcomp.1.rst create mode 100644 docs/source/guides/admin-guides/references/man1/lskitdeployparam.1.rst create mode 100644 docs/source/guides/admin-guides/references/man1/rmkit.1.rst create mode 100644 docs/source/guides/admin-guides/references/man1/rmkitcomp.1.rst create mode 100644 xCAT-buildkit/pods/man1/buildkit.1.pod create mode 100644 xCAT-client/pods/man1/addkit.1.pod create mode 100644 xCAT-client/pods/man1/addkitcomp.1.pod create mode 100644 xCAT-client/pods/man1/chkkitcomp.1.pod create mode 100644 xCAT-client/pods/man1/lskit.1.pod create mode 100644 xCAT-client/pods/man1/lskitcomp.1.pod create mode 100644 xCAT-client/pods/man1/lskitdeployparam.1.pod create mode 100644 xCAT-client/pods/man1/rmkit.1.pod create mode 100644 xCAT-client/pods/man1/rmkitcomp.1.pod diff --git a/docs/source/guides/admin-guides/references/man1/addkit.1.rst b/docs/source/guides/admin-guides/references/man1/addkit.1.rst new file mode 100644 index 000000000..7c64c139e --- /dev/null +++ b/docs/source/guides/admin-guides/references/man1/addkit.1.rst @@ -0,0 +1,137 @@ + +######## +addkit.1 +######## + +.. highlight:: perl + + +**** +NAME +**** + + +\ **addkit**\ - Adds product software Kits to an xCAT cluster environmnet. + + +******** +SYNOPSIS +******** + + +\ **addkit**\ [\ **-? | -h | -**\ **-help**\ ] [\ **-v | -**\ **-version**\ ] + +\ **addkit**\ [\ **-i | -**\ **-inspection**\ ] \ *kitlist*\ + +\ **addkit**\ [\ **-V | -**\ **-verbose**\ ] [\ **-p | -**\ **-path**\ \ *path*\ ] \ *kitlist*\ + + +*********** +DESCRIPTION +*********** + + +The \ **addkit**\ command installs a kit on the xCAT management node from a kit tarfile or directory. +It creates xCAT database definitions for the kit, kitrepo, and kitcomponent. + +\ **Note:**\ xCAT Kit support is ONLY available for Linux operating systems. + + +******* +OPTIONS +******* + + + +\ **-h|-**\ **-help**\ + + Display usage message. + + + +\ **-V|-**\ **-verbose**\ + + Verbose mode. + + + +\ **-v|-**\ **-version**\ + + Command version. + + + +\ **-i|-**\ **-inspection**\ + + Show the summary of the given kits + + + +\ **-p|-**\ **-path**\ \ *path*\ + + The destination directory to which the contents of the kit tarfiles and/or kit deploy directories will be copied. When this option is not specified, the default destination directory will be formed from the installdir site attribute with ./kits subdirectory. + + + +\ *kitlist*\ + + A comma delimited list of kit_tarball_files or kit_deploy_directories to be added to the xCAT environment. Each entry can be an absolute or relative path. See xCAT documentation for more information on building kits. + + + + +************ +RETURN VALUE +************ + + +0 The command completed successfully. + +1 An error has occurred. + + +******** +EXAMPLES +******** + + +1. To add kits from tarball files: + + +.. code-block:: perl + + addkit kit-test1.tar.bz2,kit-test2.tar.bz2 + + +2. To add kits from directories: + + +.. code-block:: perl + + addkit kit-test1,kit-test2 + + +3. To add kits from tarball \ *kit-test1.tar.bz2*\ to target path \ */install/test*\ : + + +.. code-block:: perl + + addkit -p /install/test kit-test1.tar.bz2 + + +4. To see general information about kit \ *kit-test1.tar.bz2*\ without adding the kit to xCAT: + + +.. code-block:: perl + + addkit -i kit-test1.tar.bz2 + + + +******** +SEE ALSO +******** + + +lskit(1)|lskit.1, rmkit(1)|rmkit.1, addkitcomp(1)|addkitcomp.1, rmkitcomp(1)|rmkitcomp.1, chkkitcomp(1)|chkkitcomp.1 + diff --git a/docs/source/guides/admin-guides/references/man1/addkitcomp.1.rst b/docs/source/guides/admin-guides/references/man1/addkitcomp.1.rst new file mode 100644 index 000000000..16a43358a --- /dev/null +++ b/docs/source/guides/admin-guides/references/man1/addkitcomp.1.rst @@ -0,0 +1,154 @@ + +############ +addkitcomp.1 +############ + +.. highlight:: perl + + +**** +NAME +**** + + +\ **addkitcomp**\ - Assign Kit components to an xCAT osimage. + + +******** +SYNOPSIS +******** + + +\ **addkitcomp**\ [\ **-? | -h | -**\ **-help**\ ] [\ **-v | -**\ **-version**\ ] + +\ **addkitcomp**\ [\ **-V | -**\ **-verbose**\ ] [\ **-a | -**\ **-adddeps**\ ] [\ **-f | -**\ **-force**\ ] [\ **-n | -**\ **-noupgrade**\ ] [\ **-**\ **-noscripts**\ ] \ **-i**\ \ *osimage*\ \ *kitcompname_list*\ + + +*********** +DESCRIPTION +*********** + + +The \ **addkitcomp**\ command will assign kit components to an xCAT osimage. The kit component meta rpm, package rpm and deploy parameters will be added to osimage's otherpkg.pkglist and postbootscripts will be added to osimages's postbootscripts attribute. + +\ **Note:**\ xCAT Kit support is ONLY available for Linux operating systems. + + +******* +OPTIONS +******* + + + +\ **-a|-**\ **-adddeps**\ + + Assign kitcomponent dependencies to the osimage. + + + +\ **-h|-**\ **-help**\ + + Display usage message. + + + +\ **-V|-**\ **-verbose**\ + + Verbose mode. + + + +\ **-v|-**\ **-version**\ + + Command version. + + + +\ **-f|-**\ **-force**\ + + Add kit component to osimage even if there is a mismatch in OS, version, arch, serverrole, or kitcompdeps + + + +\ **-i**\ \ *osimage*\ + + The osimage name that the kit component is assigning to. + + + +\ **-n|-**\ **-noupgrade**\ + + 1. Allow multiple versions of kitcomponent to be installed into the osimage, instead of kitcomponent upgrade. + + 2. Kit components added by addkitcomp -n will be installed separately behind all other ones which have been added. + + + +\ **-**\ **-noscripts**\ + + Do not add kitcomponent's postbootscripts to osimage + + + +\ *kitcompname_list*\ + + A comma-delimited list of valid full kit component names or kit component basenames that are to be added to the osimage. + + + + +************ +RETURN VALUE +************ + + +0 The command completed successfully. + +1 An error has occurred. + + +******** +EXAMPLES +******** + + +1. To add a single kit component to osimage "rhels6.2-ppc64-netboot-compute": + + +.. code-block:: perl + + addkitcomp -i rhels6.2-ppc64-netboot-compute comp-test1-1.0-1-rhels-6.2-ppc64 + + +2. To add a kit component to osimage with dependencies, use the -a (addeps) option: + + +.. code-block:: perl + + addkitcomp -a -i rhels6.2-ppc64-netboot-compute comp-test2-1.0-1-rhels-6.2-ppc64 + + +3. To add a kit component to osimage with incompatable osarch, osversion or ostype, use the -f (force) option: + + +.. code-block:: perl + + addkitcomp -f -i rhels6.2-ppc64-netboot-compute comp-test1-1.0-1-rhels-6.2-ppc64 + + +4. To add a new version of kit component to osimage without upgrade, use the -n (noupgrade) option: + + +.. code-block:: perl + + addkitcomp -n -i rhels6.2-ppc64-netboot-compute comp-test2-1.0-1-rhels-6.2-ppc64 + + + +******** +SEE ALSO +******** + + +lskit(1)|lskit.1, addkit(1)|addkit.1, rmkit(1)|rmkit.1, rmkitcomp(1)|rmkitcomp.1, chkkitcomp(1)|chkkitcomp.1 + diff --git a/docs/source/guides/admin-guides/references/man1/buildkit.1.rst b/docs/source/guides/admin-guides/references/man1/buildkit.1.rst new file mode 100644 index 000000000..20dd710e6 --- /dev/null +++ b/docs/source/guides/admin-guides/references/man1/buildkit.1.rst @@ -0,0 +1,372 @@ + +########## +buildkit.1 +########## + +.. highlight:: perl + + +**** +NAME +**** + + +\ **buildkit**\ - Used to build a software product Kit which may be used to install software in an xCAT cluster. + + +******** +SYNOPSIS +******** + + +\ **buildkit**\ [\ **-? | -h | -**\ **-help**\ ] [\ **-v | -**\ **-version**\ ] + +To build a new Kit + +\ **buildkit**\ [\ **-V | -**\ **-verbose]**\ \ *subcommand*\ [\ *kit_name*\ ] [\ *repo_name*\ | \ **all**\ ] [\ **-l | -**\ **-kitloc**\ \ *kit_location*\ ] + +To add packages to an existing Kit. + +\ **buildkit**\ [\ **-V | -**\ **-verbose**\ ] \ *addpkgs*\ \ *kit_tarfile*\ [\ **-p | -**\ **-pkgdir**\ \ *package_directory_list*\ ] [\ **-k | -**\ **-kitversion**\ \ *version*\ ] [\ **-r | -**\ **-kitrelease**\ \ *release*\ ] [\ **-l | -**\ **-kitloc**\ \ *kit_location*\ ] + + +*********** +DESCRIPTION +*********** + + +The \ **buildkit**\ command provides a collection of utilities that may be used to package a software product as a Kit tarfile that can be used to install software on the nodes of an xCAT cluster. A Kit contains the product software packages, configuration and control information, and install and customization scripts. + +Note: The xCAT support for Kits is only available for Linux operating systems. + +You will need to run the \ **buildkit**\ command several times with different subcommands to step through the process of building a kit: + +By default the \ **buildkit**\ subcommands will operate in the current working directory, (ie. look for files, create directories etc.). You could specify a different location by using the "\ **-l | -**\ **-kitloc**\ \ *kit_location*\ " option. + +The \ *kit_location*\ is the full path name of the directory that contains the kit files. You would use the same location value for all the buildkit subcommands. + +For example, to create a new kit named "prodkit" in the directory /home/mykits/ \ *either*\ run: + + +1. + + If no location is provided then the command will create a subdirectory called "prodkit" in the current directory "/home/mykits" and the new kit files will be created there. + + \ **cd /home/mykits**\ + + \ **buildkit create prodkit**\ + + or + + + +2. + + If a location is provided then the Kit files will be created there. Note that the Kit name does not necessarily have to be the directory name where the kit files are located. + + \ **buidkit create prodkit -l /home/mykits/prodkit**\ + + + +In both cases the /home/mykits/prodkit directory is created and the inital files for the kit are created in that directory. + +The following example illustrates the basic process for building a new Kit. In this example we are building a Kit named "mytstkit". + + +1. + + Change to the directory where you wish to create the Kit. + + + +2. + + Create a template directory for your kit: + + \ **buildkit create mytstkit**\ + + + +3. + + Change directory to the new "mytstkit" subdirectory that was just created. + + \ **cd mytstkit**\ + + + +4. + + Edit the buildkit configuration file for your kit: + + \ **vi buildkit.conf**\ + + (See xCAT Kit documentation for details.) + + + +5. + + Create all required files, scripts, plugins, and packages for your kit. + + + +6. + + Validate your kit build configuration and fix any errors that are reported: + + \ **buildkit chkconfig**\ + + + +7. + + List the repos defined in your buildkit configuration file: + + \ **buildkit listrepo**\ + + + +8. + + For each repo name listed, build the repository. Note that if you need to build repositories for OS distributions, versions, or architectures that do not match the current system, you may need to copy your kit template directory to an appropriate server to build that repository, and then copy the results back to your main build server. For example, to build a repo named "rhels6.3" you would run the following command. + + \ **buildkit buildrepo rhels6.3**\ + + or, you can build all of the repos at one time if there are no OS or architecture dependencies for kitcomponent package builds or kitpackage builds: + + \ **buildkit buildrepo all**\ + + + +9. + + Build the kit tar file: + + \ **buildkit buildtar**\ + + + + +******* +OPTIONS +******* + + + +\ **-h |-**\ **-help**\ + + Display usage message. + + + +\ **-k|-**\ **-kitversion**\ \ *version*\ + + Product version. + + + +\ **-l|-**\ **-kitloc**\ \ *kit_location*\ + + The directory location of the Kit files. + + + +\ **-p|-**\ **-pkgdir**\ \ *package_directory_list*\ + + A comma-separated list of directory locations for product RPMs. + + + +\ **-r|-**\ **-kitrelease**\ \ *release*\ + + Product release. + + + +\ **-V |-**\ **-verbose**\ + + Verbose mode. + + + +\ **-v|-**\ **-version**\ + + Command version. + + + + +************ +SUB-COMMANDS +************ + + + +\ **create**\ \ *kit_basename*\ + + Creates a new kit build directory structure for kit \ *kit_basename*\ using the location specified on the command line or the current directory. The sample kit files from /opt/xcat/share/xcat/kits/kit_template are copied over, and the buildkit.conf file is modified for the specified \ *kit_basename*\ . + + + +\ **chkconfig**\ + + Reads the buildkit.conf file, verifies that the file syntax is correct and that all specified files exist. + + + +\ **listrepo**\ + + Reads the buildkit.conf file, lists all Kit package repositories listed in the file, and reports the build status for each repository. + + + +\ **buildrepo**\ {\ *repo_name*\ | \ **all**\ } + + Reads the buildkit.conf file, and builds the specified Kit package repository. The built packages are placed in the directory /build/kit_repodir/\ *repo_name*\ . If \ **all**\ is specified, all kit repositories are built. + + + +\ **cleanrepo**\ {\ *repo_name*\ | \ **all**\ } + + Reads the buildkit.conf file, and deletes all the package files and package meta data files from the /build/kit_repodir/\ *repo_name*\ directory. If \ **all**\ is specified, all kit repository files are deleted. + + + +\ **buildtar**\ + + Reads the buildkit.conf file, validates that all kit repositories have been built, and builds the Kit tar file /\ *kitname*\ .tar.bz2. + + + +\ **cleantar**\ + + Reads the /buildkit.conf file and \ *deletes*\ the following: + + + - Kit tar files matching /\ *kit_name\\*.tar.bz2*\ . + + - /build/\ *kit_name*\ + + - /rpmbuild + + - /tmp + + - /debbuild + + Caution: Make sure you back up any tar files you would like to keep before running this subcommand. + + + +\ **cleanall**\ + + Equivalent to running \ **buildkit cleanrepo all**\ and \ **buildkit cleantar**\ . + + + +\ **addpkgs**\ + + \ *kit_tarfile*\ {\ **-p**\ | \ **-**\ **-pkgdir**\ \ *package_directory_list*\ } [\ **-k**\ | \ **-**\ **-kitversion**\ \ *version*\ ] [\ **-r**\ | \ **-**\ **-kitrelease**\ \ *release*\ ] + + Add product package rpms to a previously built kit tar file. This is used for partial product kits that are built and shipped separately from the product packages, and are identified with a \ *kit_tarfile*\ name of \ *kitname*\ .\ **NEED_PRODUCT_PKGS.tar.bz2**\ . Optionally, change the kit release and version values when building the new kit tarfile. If kitcomponent version and/or release values are defaulted to the kit values, those will also be changed and new kitcomponent rpms will be built. If kit or kitcomponent scripts, plugins, or other files specify name, release, or version substitution strings, these will all be replaced with the new values when built into the new complete kit tarfile \ *kit_location*\ /\ *new_kitname*\ .\ **tar.bz2**\ . + + + + +************ +RETURN VALUE +************ + + + +0 + + The command completed successfully. + + + +1 + + An error has occurred. + + + + +******** +EXAMPLES +******** + + + +1. + + To create the sample kit shipped with the xCAT-buildkit rpm on a RHELS 6.3 server and naming it \ **mykit**\ , run the following commands: + + \ **cd /home/myuserid/kits**\ + + \ **buildkit create mykit**\ + + \ **cd mykit**\ + + \ **vi buildkit.conf**\ + + \ **buildkit chkconfig**\ + + \ **buildkit listrepo**\ + + \ **buildkit buildrepo all**\ + + \ **buildkit buildtar**\ + + + +2. + + To clean up a kit repository directory after build failures on a RHELS 6.3 server to prepare for a new kit repository build, run: + + \ **buildkit cleanrepo rhels6.3**\ + + + +3. + + To clean up all kit build files, including a previously built kit tar file, run + + \ **buildkit cleanall**\ + + + +4. + + To create a kit named "tstkit" located in /home/foobar/tstkit instead of the current working directory. + + \ **buildkit create tstkit -l /home/foobar/tstkit**\ + + + + +***** +FILES +***** + + +/opt/xcat/bin/buildkit + +/opt/xcat/share/xcat/kits/kit_template + +/opt/xcat/share/xcat/kits/kitcomponent.spec.template + +/buildkit.conf + +/build/\ *kitname*\ /kit.conf + +/\ *kitname*\ .tar.bz2 + + +******** +SEE ALSO +******** + + +addkit(1), lskit(1), rmkit(1), addkitcomp(1), rmkitcomp(1), chkkitcomp(1) + diff --git a/docs/source/guides/admin-guides/references/man1/chkkitcomp.1.rst b/docs/source/guides/admin-guides/references/man1/chkkitcomp.1.rst new file mode 100644 index 000000000..ffb675f04 --- /dev/null +++ b/docs/source/guides/admin-guides/references/man1/chkkitcomp.1.rst @@ -0,0 +1,106 @@ + +############ +chkkitcomp.1 +############ + +.. highlight:: perl + + +**** +NAME +**** + + +\ **chkkitcomp**\ - Check if Kit components are compatible with an xCAT osimage. + + +******** +SYNOPSIS +******** + + +\ **chkkitcomp**\ [\ **-? | -h | -**\ **-help**\ ] [\ **-v | -**\ **-version**\ ] + +\ **chkkitcomp**\ [\ **-V | -**\ **-verbose**\ ] \ **-i**\ \ *osimage*\ \ *kitcompname_list*\ + + +*********** +DESCRIPTION +*********** + + +The \ **chkkitcomp**\ command will check if the kit components are compatible with the xCAT osimage. + +This command will ignore the current osimage.kitcomponents setting and check if the kitcompname_list is compatible with the osimage and kit component dependencies. + +\ **Note:**\ xCAT Kit support is ONLY available for Linux operating systems. + + +******* +OPTIONS +******* + + + +\ **-h|-**\ **-help**\ + + Display usage message. + + + +\ **-V|-**\ **-verbose**\ + + Verbose mode. + + + +\ **-v|-**\ **-version**\ + + Command version. + + + +\ **-i**\ \ *osimage*\ + + The name of the osimage to check against. + + + +\ *kitcompname_list*\ + + A comma-delimited list of valid full kit component names or kit component basenames that are to be checked against the osimage. + + + + +************ +RETURN VALUE +************ + + +0 The command completed successfully. + +1 An error has occurred. + + +******** +EXAMPLES +******** + + +1. To check if a kit component, \ *comp-test1-1.0-1-rhels-6.2-ppc64*\ can be added to osimage \ *rhels6.2-ppc64-netboot-compute*\ : + + +.. code-block:: perl + + chkkitcomp -i rhels6.2-ppc64-netboot-compute comp-test1-1.0-1-rhels-6.2-ppc64 + + + +******** +SEE ALSO +******** + + +lskit(1)|lskit.1, addkit(1)|addkit.1, rmkit(1)|rmkit.1, addkitcomp(1)|addkitcomp.1, rmkitcomp(1)|rmkitcomp.1 + diff --git a/docs/source/guides/admin-guides/references/man1/lskit.1.rst b/docs/source/guides/admin-guides/references/man1/lskit.1.rst new file mode 100644 index 000000000..07081e15d --- /dev/null +++ b/docs/source/guides/admin-guides/references/man1/lskit.1.rst @@ -0,0 +1,250 @@ + +####### +lskit.1 +####### + +.. highlight:: perl + + +**** +NAME +**** + + +\ **lskit**\ - Lists information for one or more Kits. + + +******** +SYNOPSIS +******** + + +\ **lskit**\ [\ **-V**\ | \ **-**\ **-verbose**\ ] [\ **-F**\ | \ **-**\ **-framework**\ \ *kitattr_names*\ ] [\ **-x**\ | \ **-**\ **-xml**\ | \ **-**\ **-XML**\ ] [\ **-K**\ | \ **-**\ **-kitattr**\ \ *kitattr_names*\ ] [\ **-R**\ | \ **-**\ **-repoattr**\ \ *repoattr_names*\ ] [\ **-C**\ | \ **-**\ **-compattr**\ \ *compattr_names*\ ] [\ *kit_names*\ ] + +\ **lskit**\ [\ **-?**\ | \ **-h**\ | \ **-**\ **-help**\ | \ **-v**\ | \ **-**\ **-version**\ ] + +\ **lskit**\ [\ **-F**\ | \ **-**\ **-framework**\ \ *kit_path_name*\ ] + + +*********** +DESCRIPTION +*********** + + +The \ **lskit**\ command is used to list information for one or more kits. A kit is a special kind of package that is used to install a software product on one or more nodes in an xCAT cluster. + +Note: The xCAT support for Kits is only available for Linux operating systems. + +The \ **lskit**\ command outputs the following info for each kit: the kit's basic info, the kit's repositories, and the kit's components. The command outputs the info in two formats: human-readable format (default), and XML format. Use the -x option to view the info in XML format. + +Input to the command can specify any number or combination of the input options. + + +******* +OPTIONS +******* + + + +\ **-F|-**\ **-framework**\ \ *kit_path_name*\ + + Use this option to display the framework values of the specified Kit tarfile. This information is retreived directly from the tarfile and can be done before the Kit has been defined in the xCAT database. This option cannot be combined with other options. + + + +\ **-K|-**\ **-kitattr**\ \ *kitattr_names*\ + + Where \ *kitattr_names*\ is a comma-delimited list of kit attribute names. The names correspond to attribute names in the \ **kit**\ table. The \ **lskit**\ command will only display the specified kit attributes. + + + +\ **-R|-**\ **-repoattr**\ \ *repoattr_names*\ + + Where \ *repoattr_names*\ is a comma-delimited list of kit repository attribute names. The names correspond to attribute names in the \ **kitrepo**\ table. The \ **lskit**\ command will only display the specified kit repository attributes. + + + +\ **-C|-**\ **-compattr**\ \ *compattr_names*\ + + where \ *compattr_names*\ is a comma-delimited list of kit component attribute names. The names correspond to attribute names in the \ **kitcomponent**\ table. The \ **lskit**\ command will only display the specified kit component attributes. + + + +\ *kit_names*\ + + is a comma-delimited list of kit names. The \ **lskit**\ command will only display the kits matching these names. + + + +\ **-x|-**\ **-xml|-**\ **-XML**\ + + Need XCATXMLTRACE=1 env when using -x|--xml|--XML, for example: XCATXMLTRACE=1 lskit -x testkit-1.0.0 + Return the output with XML tags. The data is returned as: + + + .. code-block:: perl + + + + ... + + + ... + + + ... + + + + + Each tag contains info for one kit. The info inside is structured as follows: + + + .. code-block:: perl + + The sub-tag contains the kit's basic info. + The sub-tags store info about the kit's repositories. + The sub-tags store info about the kit's components. + + + The data inside is returned as: + + + .. code-block:: perl + + + + ... + + + + ... + + ... + + + ... + + ... + + + + + +\ **-V|-**\ **-verbose**\ + + Display additional progress and error messages. + + + +\ **-v|-**\ **-version**\ + + Command Version. + + + +\ **-?|-h|-**\ **-help**\ + + Display usage message. + + + + +************ +RETURN VALUE +************ + + + +0 The command completed successfully. + + + +1 An error has occurred. + + + + +******** +EXAMPLES +******** + + + +1. To list all kits, enter: + + + .. code-block:: perl + + lskit + + + + +2. To list the kit "kit-test1-1.0-Linux", enter: + + + .. code-block:: perl + + lskit kit-test1-1.0-Linux + + + + +3. To list the kit "kit-test1-1.0-Linux" for selected attributes, enter: + + + .. code-block:: perl + + lskit -K basename,description -R kitreponame -C kitcompname kit-test1-1.0-Linux + + + + +4. To list the framework value of a Kit tarfile. + + + .. code-block:: perl + + lskit -F /myhome/mykits/pperte-1.3.0.2-0-x86_64.tar.bz2 + + + Output is similar to: + + + .. code-block:: perl + + Extracting the kit.conf file from /myhome/mykits/pperte-1.3.0.2-0-x86_64.tar.bz2. Please wait. + + kitframework=2 + compatible_kitframeworks=0,1,2 + + + + +5. To list kit "testkit-1.0-1" with XML tags, enter: + + + .. code-block:: perl + + XCATXMLTRACE=1 lskit -x testkit-1.0-1 + + + + + +***** +FILES +***** + + +/opt/xcat/bin/lskit + + +******** +SEE ALSO +******** + + +lskitcomp(1)|lskitcomp.1, lskitdeployparam(1)|lskitdeployparam.1, addkit(1)|addkit.1, rmkit(1)|rmkit.1, addkitcomp(1)|addkitcomp.1, rmkitcomp(1)|rmkitcomp.1 + diff --git a/docs/source/guides/admin-guides/references/man1/lskitcomp.1.rst b/docs/source/guides/admin-guides/references/man1/lskitcomp.1.rst new file mode 100644 index 000000000..895a065e1 --- /dev/null +++ b/docs/source/guides/admin-guides/references/man1/lskitcomp.1.rst @@ -0,0 +1,247 @@ + +########### +lskitcomp.1 +########### + +.. highlight:: perl + + +**** +NAME +**** + + +\ **lskitcomp**\ - Used to list information for one or more kit components. + + +******** +SYNOPSIS +******** + + +\ **lskitcomp**\ [\ **-V**\ | \ **-**\ **-verbose**\ ] [\ **-x**\ | \ **-**\ **-xml**\ | \ **-**\ **-XML**\ ] [\ **-C**\ | \ **-**\ **-compattr**\ \ *compattr_names*\ ] [\ **-O**\ | \ **-**\ **-osdistro**\ \ *os_distro*\ ] [\ **-S**\ | \ **-**\ **-serverrole**\ \ *server_role*\ ] [\ *kitcomp_names*\ ] + +\ **lskitcomp**\ [\ **-?**\ | \ **-h**\ | \ **-**\ **-help**\ | \ **-v**\ | \ **-**\ **-version**\ ] + + +*********** +DESCRIPTION +*********** + + +The \ **lskitcomp**\ command is used to list information for one or more kit components. A kit is made up of one or more kit components. Each kit component is a meta package used to install a software product component on one or more nodes in an xCAT cluster. + +The \ **lskitcomp**\ command outputs the kit component info in two formats: human-readable format (default), and XML format. Use the -x option to view the info in XML format. + +Input to the command can specify any number or combination of the input options. + +Note: The xCAT support for Kits is only available for Linux operating systems. + + +******* +OPTIONS +******* + + + +\ **-C|-**\ **-compattr**\ \ *compattr_names*\ + + where \ *compattr_names*\ is a comma-delimited list of kit component attribute names. The names correspond to attribute names in the \ **kitcomponent**\ table. The \ **lskitcomp**\ command will only display the specified kit component attributes. + + + +\ **-O|-**\ **-osdistro**\ \ *os_distro*\ + + where \ *os_distro*\ is the name of an osdistro in \ **osdistro**\ table. The \ **lskitcomp**\ command will only display the kit components matching the specified osdistro. + + + +\ **-S|-**\ **-serverrole**\ \ *server_role*\ + + where \ *server_role*\ is the name of a server role. The typical server roles are: mgtnode, servicenode, computenode, loginnode, storagennode. The \ **lskitcomp**\ command will only display the kit components matching the specified server role. + + + +\ *kitcomp_names*\ + + is a comma-delimited list of kit component names. The \ **lskitcomp**\ command will only display the kit components matching the specified names. + + + +\ **-x|-**\ **-xml|-**\ **-XML**\ + + Need XCATXMLTRACE=1 env when using -x|--xml|--XML. + Return the output with XML tags. The data is returned as: + + + .. code-block:: perl + + + + ... + + + ... + + + ... + + + + + Each tag contains info for a group of kit components belonging to the same kit. The info inside is structured as follows: + + + .. code-block:: perl + + The sub-tag contains the kit's name. + The sub-tags store info about the kit's components. + + + The data inside is returned as: + + + .. code-block:: perl + + + + ... + + + + ... + + ... + + + + + +\ **-V|-**\ **-verbose**\ + + Display additional progress and error messages. + + + +\ **-v|-**\ **-version**\ + + Command Version. + + + +\ **-?|-h|-**\ **-help**\ + + Display usage message. + + + + +************ +RETURN VALUE +************ + + + +0 The command completed successfully. + + + +1 An error has occurred. + + + + +******** +EXAMPLES +******** + + + +1. + + To list all kit components, enter: + + + .. code-block:: perl + + lskitcomp + + + + +2. + + To list the kit component "comp-server-1.0-1-rhels-6-x86_64", enter: + + + .. code-block:: perl + + lskitcomp comp-server-1.0-1-rhels-6-x86_64 + + + + +3. + + To list the kit component "comp-server-1.0-1-rhels-6-x86_64" for selected kit component attributes, enter: + + + .. code-block:: perl + + lskitcomp -C kitcompname,desc comp-server-1.0-1-rhels-6-x86_64 + + + + +4. + + To list kit components compatible with "rhels-6.2-x86_64" osdistro, enter: + + + .. code-block:: perl + + lskitcomp -O rhels-6.2-x86_64 + + + + +5. + + To list kit components compatible with "rhels-6.2-x86_64" osdistro and "computenode" server role, enter: + + + .. code-block:: perl + + lskitcomp -O rhels-6.2-x86_64 -S computenode + + + + +6. + + To list the kit component "testkit-compute-1.0-1-ubuntu-14.04-ppc64el" with XML tags, enter: + + + .. code-block:: perl + + XCATXMLTRACE=1 lskitcomp -x testkit-compute-1.0-1-ubuntu-14.04-ppc64el + + + + + +***** +FILES +***** + + +/opt/xcat/bin/lskitcomp + + +******** +SEE ALSO +******** + + +lskit(1)|lskit.1, lskitdeployparam(1)|lskitdeployparam.1, addkit(1)|addkit.1, rmkit(1)|rmkit.1, addkitcomp(1)|addkitcomp.1, rmkitcomp(1)|rmkitcomp.1 + diff --git a/docs/source/guides/admin-guides/references/man1/lskitdeployparam.1.rst b/docs/source/guides/admin-guides/references/man1/lskitdeployparam.1.rst new file mode 100644 index 000000000..28cc34092 --- /dev/null +++ b/docs/source/guides/admin-guides/references/man1/lskitdeployparam.1.rst @@ -0,0 +1,162 @@ + +################## +lskitdeployparam.1 +################## + +.. highlight:: perl + + +**** +NAME +**** + + +\ **lskitdeployparam**\ - Lists the deployment parameters for one or more Kits or Kit components + + +******** +SYNOPSIS +******** + + +\ **lskitdeployparam**\ [\ **-V**\ | \ **-**\ **-verbose**\ ] [\ **-x**\ | \ **-**\ **-xml**\ | \ **-**\ **-XML**\ ] [\ **-k**\ | \ **-**\ **-kitname**\ \ *kit_names*\ ] [\ **-c**\ | \ **-**\ **-compname**\ \ *comp_names*\ ] + +\ **lskitdeployparam**\ [\ **-?**\ | \ **-h**\ | \ **-**\ **-help**\ | \ **-v**\ | \ **-**\ **-version**\ ] + + +*********** +DESCRIPTION +*********** + + +The \ **lskitdeployparam**\ command is used to list the kit deployment parameters for one or more kits, or one or more kit components. Kit deployment parameters are used to customize the installation or upgrade of kit components. + +The \ **lskitdeployparam**\ command outputs the kit component information in two formats: human-readable format (default), and XML format. Use the -x option to view the information in XML format. + +Input to the command can specify any combination of the input options. + +Note: The xCAT support for Kits is only available for Linux operating systems. + + +******* +OPTIONS +******* + + + +\ **-k|-**\ **-kitname**\ \ *kit_names*\ + + Where \ *kit_names*\ is a comma-delimited list of kit names. The \ **lskitdeployparam**\ command will only display the deployment parameters for the kits with the matching names. + + + +\ **-c|-**\ **-compname**\ \ *comp_names*\ + + Where \ *comp_names*\ is a comma-delimited list of kit component names. The \ **lskitdeployparam**\ command will only display the deployment parameters for the kit components with the matching names. + + + +\ **-x|-**\ **-xml|-**\ **-XML**\ + + Return the output with XML tags. The data is returned as: + + + .. code-block:: perl + + + + KIT_KIT1_PARAM1 + value11 + + + + + KIT_KIT1_PARAM2 + value12 + + + ... + + + + +\ **-V|-**\ **-verbose**\ + + Display additional progress and error messages. + + + +\ **-v|-**\ **-version**\ + + Command Version. + + + +\ **-?|-h|-**\ **-help**\ + + Display usage message. + + + + +************ +RETURN VALUE +************ + + + +0 The command completed successfully. + + + +1 An error has occurred. + + + + +******** +EXAMPLES +******** + + + +1. + + To list kit deployment parameters for kit "kit-test1-1.0-Linux", enter: + + + .. code-block:: perl + + lskitdeployparam -k kit-test1-1.0-Linux + + + + +2. + + To list kit deployment parameters for kit component "comp-server-1.0-1-rhels-6-x86_64", enter: + + + .. code-block:: perl + + lskitdeployparam -c comp-server-1.0-1-rhels-6-x86_64 + + + + + +***** +FILES +***** + + +/opt/xcat/bin/lskitdeployparam + + +******** +SEE ALSO +******** + + +lskit(1)|lskit.1, lskitcomp(1)|lskitcomp.1, addkit(1)|addkit.1, rmkit(1)|rmkit.1, addkitcomp(1)|addkitcomp.1, rmkitcomp(1)|rmkitcomp.1 + diff --git a/docs/source/guides/admin-guides/references/man1/rmkit.1.rst b/docs/source/guides/admin-guides/references/man1/rmkit.1.rst new file mode 100644 index 000000000..d83ca67ce --- /dev/null +++ b/docs/source/guides/admin-guides/references/man1/rmkit.1.rst @@ -0,0 +1,151 @@ + +####### +rmkit.1 +####### + +.. highlight:: perl + + +**** +NAME +**** + + +\ **rmkit**\ - Remove Kits from xCAT + + +******** +SYNOPSIS +******** + + +\ **rmkit**\ [\ **-? | -h | -**\ **-help**\ ] [\ **-v | -**\ **-version**\ ] + +\ **rmkit**\ [\ **-V | -**\ **-verbose**\ ] [\ **-f | -**\ **-force**\ ] [\ **-t | -**\ **-test**\ ] \ *kitlist*\ + + +*********** +DESCRIPTION +*********** + + +The \ **rmkit**\ command removes kits on the xCAT management node from kit names. + +Note: The xCAT support for Kits is only available for Linux operating systems. + + +******* +OPTIONS +******* + + + +\ **-h|-**\ **-help**\ + + Display usage message. + + + +\ **-V|-**\ **-verbose**\ + + Verbose mode. + + + +\ **-v|-**\ **-version**\ + + Command version. + + + +\ **-f|-**\ **-force**\ + + Remove this kit even there is any component in this kit is listed by osimage.kitcomponents. If this option is not specified, this kit will not be removed if any kit components listed in an osimage.kitcomponents + + + +\ **-t|-**\ **-test**\ + + Test if kitcomponents in this kit are used by osimage + + + +\ *kitlist*\ + + A comma delimited list of kits that are to be removed from the xCAT cluster. Each entry can be a kitname or kit basename. For kit basename, rmkit command will remove all the kits that have that kit basename. + + + + +************ +RETURN VALUE +************ + + +0 The command completed successfully. + +1 An error has occurred. + + +******** +EXAMPLES +******** + + +1. To remove two kits from tarball files. + + +.. code-block:: perl + + rmkit kit-test1,kit-test2 + + +Output is similar to: + + +.. code-block:: perl + + Kit kit-test1-1.0-Linux,kit-test2-1.0-Linux was successfully removed. + + +2. To remove two kits from tarball files even the kit components in them are still being used by osimages. + + +.. code-block:: perl + + rmkit kit-test1,kit-test2 --force + + +Output is similar to: + + +.. code-block:: perl + + Kit kit-test1-1.0-Linux,kit-test2-1.0-Linux was successfully removed. + + +3. To list kitcomponents in this kit used by osimage + + +.. code-block:: perl + + rmkit kit-test1,kit-test2 -t + + +Output is similar to: + + +.. code-block:: perl + + kit-test1-kitcomp-1.0-Linux is being used by osimage osimage-test + Following kitcomponents are in use: kit-test1-kitcomp-1.0-Linux + + + +******** +SEE ALSO +******** + + +lskit(1)|lskit.1, addkit(1)|addkit.1, addkitcomp(1)|addkitcomp.1, rmkitcomp(1)|rmkitcomp.1, chkkitcomp(1)|chkkitcomp.1 + diff --git a/docs/source/guides/admin-guides/references/man1/rmkitcomp.1.rst b/docs/source/guides/admin-guides/references/man1/rmkitcomp.1.rst new file mode 100644 index 000000000..183372691 --- /dev/null +++ b/docs/source/guides/admin-guides/references/man1/rmkitcomp.1.rst @@ -0,0 +1,162 @@ + +########### +rmkitcomp.1 +########### + +.. highlight:: perl + + +**** +NAME +**** + + +\ **rmkitcomp**\ - Remove Kit components from an xCAT osimage. + + +******** +SYNOPSIS +******** + + +\ **rmkitcomp**\ [\ **-? | -h | -**\ **-help**\ ] [\ **-v | -**\ **-version**\ ] + +\ **rmkitcomp**\ [\ **-V | -**\ **-verbose**\ ] [\ **-u | -**\ **-uninstall**\ ] [\ **-f | -**\ **-force**\ ] [\ **-**\ **-noscripts**\ ] \ **-i**\ \ *osimage*\ \ *kitcompname_list*\ + + +*********** +DESCRIPTION +*********** + + +The \ **rmkitcomp**\ command removes kit components from an xCAT osimage. All the kit component attribute values that are contained in the osimage will be removed, and the kit component meta rpm and package rpm could be uninstalled by \ **-u|-**\ **-uninstall**\ option. + +Note: The xCAT support for Kits is only available for Linux operating systems. + + +******* +OPTIONS +******* + + + +\ **-u|-**\ **-uninstall**\ + + All the kit component meta rpms and package rpms in otherpkglist will be uninstalled during genimage for stateless image and updatenode for stateful nodes. + + + +\ **-h|-**\ **-help**\ + + Display usage message. + + + +\ **-V|-**\ **-verbose**\ + + Verbose mode. + + + +\ **-v|-**\ **-version**\ + + Command version. + + + +\ **-f|-**\ **-force**\ + + Remove this kit component from osimage no matter it is a dependency of other kit components. + + + +\ **-**\ **-noscripts**\ + + Do not remove kitcomponent's postbootscripts from osimage + + + +\ **-i**\ \ *osimage*\ + + osimage name that include this kit component. + + + +\ *kitcompname_list*\ + + A comma-delimited list of valid full kit component names or kit component basenames that are to be removed from the osimage. If a basename is specified, all kitcomponents matching that basename will be removed from the osimage. + + + + +************ +RETURN VALUE +************ + + +0 The command completed successfully. + +1 An error has occurred. + + +******** +EXAMPLES +******** + + +1. To remove a kit component from osimage + + +.. code-block:: perl + + rmkitcomp -i rhels6.2-ppc64-netboot-compute comp-test1-1.0-1-rhels-6.2-ppc64 + + +Output is similar to: + + +.. code-block:: perl + + kitcomponents comp-test1-1.0-1-rhels-6.2-ppc64 were removed from osimage rhels6.2-ppc64-netboot-compute successfully + + +2. To remove a kit component even it is still used as a dependency of other kit component. + + +.. code-block:: perl + + rmkitcomp -f -i rhels6.2-ppc64-netboot-compute comp-test1-1.0-1-rhels-6.2-ppc64 + + +Output is similar to: + + +.. code-block:: perl + + kitcomponents comp-test1-1.0-1-rhels-6.2-ppc64 were removed from osimage rhels6.2-ppc64-netboot-compute successfully + + +3. To remove a kit component from osimage and also remove the kit component meta RPM and package RPM. So in next genimage for statelss image and updatenode for stateful nodes, the kit component meta RPM and package RPM will be uninstalled. + + +.. code-block:: perl + + rmkitcomp -u -i rhels6.2-ppc64-netboot-compute comp-test1-1.0-1-rhels-6.2-ppc64 + + +Output is similar to: + + +.. code-block:: perl + + kitcomponents comp-test1-1.0-1-rhels-6.2-ppc64 were removed from osimage rhels6.2-ppc64-netboot-compute successfully + + + +******** +SEE ALSO +******** + + +lskit(1)|lskit.1, addkit(1)|addkit.1, rmkit(1)|rmkit.1, addkitcomp(1)|addkitcomp.1, chkkitcomp(1)|chkkitcomp.1 + diff --git a/xCAT-buildkit/pods/man1/buildkit.1.pod b/xCAT-buildkit/pods/man1/buildkit.1.pod new file mode 100644 index 000000000..7d9c49756 --- /dev/null +++ b/xCAT-buildkit/pods/man1/buildkit.1.pod @@ -0,0 +1,285 @@ +=head1 NAME + +B - Used to build a software product Kit which may be used to install software in an xCAT cluster. + +=head1 SYNOPSIS + +B [B<-?>|B<-h>|B<--help>] [B<-v>|B<--version>] + +To build a new Kit + +B [B<-V>|B<--verbose]> I [I] [I | B] [B<-l>|B<--kitloc> I] + +To add packages to an existing Kit. + +B [B<-V>|B<--verbose>] I I [B<-p>|B<--pkgdir> I] [B<-k>|B<--kitversion> I] [B<-r>|B<--kitrelease> I] [B<-l>|B<--kitloc> I] + +=head1 DESCRIPTION + +The B command provides a collection of utilities that may be used to package a software product as a Kit tarfile that can be used to install software on the nodes of an xCAT cluster. A Kit contains the product software packages, configuration and control information, and install and customization scripts. + +Note: The xCAT support for Kits is only available for Linux operating systems. + +You will need to run the B command several times with different subcommands to step through the process of building a kit: + +By default the B subcommands will operate in the current working directory, (ie. look for files, create directories etc.). You could specify a different location by using the "B<-l | --kitloc> I" option. + +The I is the full path name of the directory that contains the kit files. You would use the same location value for all the buildkit subcommands. + +For example, to create a new kit named "prodkit" in the directory /home/mykits/ I run: + +=over 4 + +=item 1. + +If no location is provided then the command will create a subdirectory called "prodkit" in the current directory "/home/mykits" and the new kit files will be created there. + +B + +B + +or + +=item 2. + +If a location is provided then the Kit files will be created there. Note that the Kit name does not necessarily have to be the directory name where the kit files are located. + +B + +=back + +In both cases the /home/mykits/prodkit directory is created and the inital files for the kit are created in that directory. + +The following example illustrates the basic process for building a new Kit. In this example we are building a Kit named "mytstkit". + +=over 4 + +=item 1. + +Change to the directory where you wish to create the Kit. + +=item 2. + +Create a template directory for your kit: + +B + +=item 3. + +Change directory to the new "mytstkit" subdirectory that was just created. + +B + +=item 4. + +Edit the buildkit configuration file for your kit: + +B + +(See xCAT Kit documentation for details.) + +=item 5. + +Create all required files, scripts, plugins, and packages for your kit. + +=item 6. + +Validate your kit build configuration and fix any errors that are reported: + +B + +=item 7. + +List the repos defined in your buildkit configuration file: + +B + +=item 8. + +For each repo name listed, build the repository. Note that if you need to build repositories for OS distributions, versions, or architectures that do not match the current system, you may need to copy your kit template directory to an appropriate server to build that repository, and then copy the results back to your main build server. For example, to build a repo named "rhels6.3" you would run the following command. + +B + +or, you can build all of the repos at one time if there are no OS or architecture dependencies for kitcomponent package builds or kitpackage builds: + +B + +=item 9. + +Build the kit tar file: + +B + +=back + +=head1 OPTIONS + +=over 10 + +=item B<-h |--help> + +Display usage message. + +=item B<-k|--kitversion> I + +Product version. + +=item B<-l|--kitloc> I + +The directory location of the Kit files. + +=item B<-p|--pkgdir> I + +A comma-separated list of directory locations for product RPMs. + +=item B<-r|--kitrelease> I + +Product release. + +=item B<-V |--verbose> + +Verbose mode. + +=item B<-v|--version> + +Command version. + +=back + +=head1 SUB-COMMANDS + +=over 10 + +=item B I + +Creates a new kit build directory structure for kit I using the location specified on the command line or the current directory. The sample kit files from /opt/xcat/share/xcat/kits/kit_template are copied over, and the buildkit.conf file is modified for the specified I. + +=item B + +Reads the buildkit.conf file, verifies that the file syntax is correct and that all specified files exist. + +=item B + +Reads the buildkit.conf file, lists all Kit package repositories listed in the file, and reports the build status for each repository. + +=item B {I | B} + +Reads the buildkit.conf file, and builds the specified Kit package repository. The built packages are placed in the directory /build/kit_repodir/I. If B is specified, all kit repositories are built. + +=item B {I | B} + +Reads the buildkit.conf file, and deletes all the package files and package meta data files from the /build/kit_repodir/I directory. If B is specified, all kit repository files are deleted. + +=item B + +Reads the buildkit.conf file, validates that all kit repositories have been built, and builds the Kit tar file /I.tar.bz2. + +=item B + +Reads the /buildkit.conf file and I the following: + +=over 4 + +- Kit tar files matching /I. + +- /build/I + +- /rpmbuild + +- /tmp + +- /debbuild + +=back + +Caution: Make sure you back up any tar files you would like to keep before running this subcommand. + +=item B + +Equivalent to running B and B. + +=item B + +I {B<-p> | B<--pkgdir> I} [B<-k> | B<--kitversion> I] [B<-r> | B<--kitrelease> I] + +Add product package rpms to a previously built kit tar file. This is used for partial product kits that are built and shipped separately from the product packages, and are identified with a I name of I.B. Optionally, change the kit release and version values when building the new kit tarfile. If kitcomponent version and/or release values are defaulted to the kit values, those will also be changed and new kitcomponent rpms will be built. If kit or kitcomponent scripts, plugins, or other files specify name, release, or version substitution strings, these will all be replaced with the new values when built into the new complete kit tarfile I/I.B. + +=back + +=head1 RETURN VALUE + +=over 3 + +=item 0 + +The command completed successfully. + +=item 1 + +An error has occurred. + +=back + +=head1 EXAMPLES + +=over 3 + +=item 1. + +To create the sample kit shipped with the xCAT-buildkit rpm on a RHELS 6.3 server and naming it B, run the following commands: + +B + +B + +B + +B + +B + +B + +B + +B + +=item 2. + +To clean up a kit repository directory after build failures on a RHELS 6.3 server to prepare for a new kit repository build, run: + +B + +=item 3. + +To clean up all kit build files, including a previously built kit tar file, run + +B + +=item 4. + +To create a kit named "tstkit" located in /home/foobar/tstkit instead of the current working directory. + +B + +=back + +=head1 FILES + +/opt/xcat/bin/buildkit + +/opt/xcat/share/xcat/kits/kit_template + +/opt/xcat/share/xcat/kits/kitcomponent.spec.template + +/buildkit.conf + +/build/I/kit.conf + +/I.tar.bz2 + + +=head1 SEE ALSO + +addkit(1), lskit(1), rmkit(1), addkitcomp(1), rmkitcomp(1), chkkitcomp(1) + diff --git a/xCAT-client/pods/man1/addkit.1.pod b/xCAT-client/pods/man1/addkit.1.pod new file mode 100644 index 000000000..f07bddf3c --- /dev/null +++ b/xCAT-client/pods/man1/addkit.1.pod @@ -0,0 +1,79 @@ +=head1 NAME + +B - Adds product software Kits to an xCAT cluster environmnet. + +=head1 SYNOPSIS + +B [B<-?>|B<-h>|B<--help>] [B<-v>|B<--version>] + +B [B<-i>|B<--inspection>] I + +B [B<-V>|B<--verbose>] [B<-p>|B<--path> I] I + +=head1 DESCRIPTION + +The B command installs a kit on the xCAT management node from a kit tarfile or directory. +It creates xCAT database definitions for the kit, kitrepo, and kitcomponent. + +B xCAT Kit support is ONLY available for Linux operating systems. + +=head1 OPTIONS + +=over 10 + +=item B<-h|--help> + +Display usage message. + +=item B<-V|--verbose> + +Verbose mode. + +=item B<-v|--version> + +Command version. + +=item B<-i|--inspection> + +Show the summary of the given kits + +=item B<-p|--path> I + +The destination directory to which the contents of the kit tarfiles and/or kit deploy directories will be copied. When this option is not specified, the default destination directory will be formed from the installdir site attribute with ./kits subdirectory. + +=item I + +A comma delimited list of kit_tarball_files or kit_deploy_directories to be added to the xCAT environment. Each entry can be an absolute or relative path. See xCAT documentation for more information on building kits. + +=back + +=head1 RETURN VALUE + +0 The command completed successfully. + +1 An error has occurred. + +=head1 EXAMPLES + +1. To add kits from tarball files: + + addkit kit-test1.tar.bz2,kit-test2.tar.bz2 + +2. To add kits from directories: + + addkit kit-test1,kit-test2 + +3. To add kits from tarball I to target path I: + + addkit -p /install/test kit-test1.tar.bz2 + +4. To see general information about kit I without adding the kit to xCAT: + + addkit -i kit-test1.tar.bz2 + + +=head1 SEE ALSO + +L, L, L, L, L + + diff --git a/xCAT-client/pods/man1/addkitcomp.1.pod b/xCAT-client/pods/man1/addkitcomp.1.pod new file mode 100644 index 000000000..99b138700 --- /dev/null +++ b/xCAT-client/pods/man1/addkitcomp.1.pod @@ -0,0 +1,90 @@ +=head1 NAME + +B - Assign Kit components to an xCAT osimage. + +=head1 SYNOPSIS + +B [B<-?>|B<-h>|B<--help>] [B<-v>|B<--version>] + +B [B<-V>|B<--verbose>] [B<-a>|B<--adddeps>] [B<-f>|B<--force>] [B<-n>|B<--noupgrade>] [B<--noscripts>] B<-i> I I + +=head1 DESCRIPTION + +The B command will assign kit components to an xCAT osimage. The kit component meta rpm, package rpm and deploy parameters will be added to osimage's otherpkg.pkglist and postbootscripts will be added to osimages's postbootscripts attribute. + +B xCAT Kit support is ONLY available for Linux operating systems. + +=head1 OPTIONS + +=over 10 + +=item B<-a|--adddeps> + +Assign kitcomponent dependencies to the osimage. + +=item B<-h|--help> + +Display usage message. + +=item B<-V|--verbose> + +Verbose mode. + +=item B<-v|--version> + +Command version. + +=item B<-f|--force> + +Add kit component to osimage even if there is a mismatch in OS, version, arch, serverrole, or kitcompdeps + +=item B<-i> I + +The osimage name that the kit component is assigning to. + +=item B<-n|--noupgrade> + +1. Allow multiple versions of kitcomponent to be installed into the osimage, instead of kitcomponent upgrade. + +2. Kit components added by addkitcomp -n will be installed separately behind all other ones which have been added. + +=item B<--noscripts> + +Do not add kitcomponent's postbootscripts to osimage + +=item I + +A comma-delimited list of valid full kit component names or kit component basenames that are to be added to the osimage. + +=back + +=head1 RETURN VALUE + +0 The command completed successfully. + +1 An error has occurred. + +=head1 EXAMPLES + +1. To add a single kit component to osimage "rhels6.2-ppc64-netboot-compute": + + addkitcomp -i rhels6.2-ppc64-netboot-compute comp-test1-1.0-1-rhels-6.2-ppc64 + +2. To add a kit component to osimage with dependencies, use the -a (addeps) option: + + addkitcomp -a -i rhels6.2-ppc64-netboot-compute comp-test2-1.0-1-rhels-6.2-ppc64 + +3. To add a kit component to osimage with incompatable osarch, osversion or ostype, use the -f (force) option: + + addkitcomp -f -i rhels6.2-ppc64-netboot-compute comp-test1-1.0-1-rhels-6.2-ppc64 + +4. To add a new version of kit component to osimage without upgrade, use the -n (noupgrade) option: + + addkitcomp -n -i rhels6.2-ppc64-netboot-compute comp-test2-1.0-1-rhels-6.2-ppc64 + + +=head1 SEE ALSO + +L, L, L, L, L + + diff --git a/xCAT-client/pods/man1/chkkitcomp.1.pod b/xCAT-client/pods/man1/chkkitcomp.1.pod new file mode 100644 index 000000000..8df706a6e --- /dev/null +++ b/xCAT-client/pods/man1/chkkitcomp.1.pod @@ -0,0 +1,61 @@ +=head1 NAME + +B - Check if Kit components are compatible with an xCAT osimage. + +=head1 SYNOPSIS + +B [B<-?>|B<-h>|B<--help>] [B<-v>|B<--version>] + +B [B<-V>|B<--verbose>] B<-i> I I + +=head1 DESCRIPTION + +The B command will check if the kit components are compatible with the xCAT osimage. + +This command will ignore the current osimage.kitcomponents setting and check if the kitcompname_list is compatible with the osimage and kit component dependencies. + +B xCAT Kit support is ONLY available for Linux operating systems. + +=head1 OPTIONS + +=over 10 + +=item B<-h|--help> + +Display usage message. + +=item B<-V|--verbose> + +Verbose mode. + +=item B<-v|--version> + +Command version. + +=item B<-i> I + +The name of the osimage to check against. + +=item I + +A comma-delimited list of valid full kit component names or kit component basenames that are to be checked against the osimage. + +=back + +=head1 RETURN VALUE + +0 The command completed successfully. + +1 An error has occurred. + +=head1 EXAMPLES + +1. To check if a kit component, I can be added to osimage I: + + chkkitcomp -i rhels6.2-ppc64-netboot-compute comp-test1-1.0-1-rhels-6.2-ppc64 + + + +=head1 SEE ALSO + +L, L, L, L, L diff --git a/xCAT-client/pods/man1/lskit.1.pod b/xCAT-client/pods/man1/lskit.1.pod new file mode 100644 index 000000000..fe450efc4 --- /dev/null +++ b/xCAT-client/pods/man1/lskit.1.pod @@ -0,0 +1,168 @@ +=head1 NAME + +B - Lists information for one or more Kits. + + +=head1 SYNOPSIS + +B [B<-V> | B<--verbose>] [B<-F> | B<--framework> I] [B<-x> | B<--xml> | B<--XML>] [B<-K> | B<--kitattr> I] [B<-R> | B<--repoattr> I] [B<-C> | B<--compattr> I] [I] + +B [B<-?> | B<-h> | B<--help> | B<-v> | B<--version>] + +B [B<-F> | B<--framework> I] + + +=head1 DESCRIPTION + +The B command is used to list information for one or more kits. A kit is a special kind of package that is used to install a software product on one or more nodes in an xCAT cluster. + +Note: The xCAT support for Kits is only available for Linux operating systems. + +The B command outputs the following info for each kit: the kit's basic info, the kit's repositories, and the kit's components. The command outputs the info in two formats: human-readable format (default), and XML format. Use the -x option to view the info in XML format. + +Input to the command can specify any number or combination of the input options. + +=head1 OPTIONS + +=over 10 + +=item B<-F|--framework> I + +Use this option to display the framework values of the specified Kit tarfile. This information is retreived directly from the tarfile and can be done before the Kit has been defined in the xCAT database. This option cannot be combined with other options. + +=item B<-K|--kitattr> I + +Where I is a comma-delimited list of kit attribute names. The names correspond to attribute names in the B table. The B command will only display the specified kit attributes. + + +=item B<-R|--repoattr> I + +Where I is a comma-delimited list of kit repository attribute names. The names correspond to attribute names in the B table. The B command will only display the specified kit repository attributes. + + +=item B<-C|--compattr> I + +where I is a comma-delimited list of kit component attribute names. The names correspond to attribute names in the B table. The B command will only display the specified kit component attributes. + + +=item I + +is a comma-delimited list of kit names. The B command will only display the kits matching these names. + + +=item B<-x|--xml|--XML> + +Need XCATXMLTRACE=1 env when using -x|--xml|--XML, for example: XCATXMLTRACE=1 lskit -x testkit-1.0.0 +Return the output with XML tags. The data is returned as: + + + + ... + + + ... + + + ... + + + +Each tag contains info for one kit. The info inside is structured as follows: + + The sub-tag contains the kit's basic info. + The sub-tags store info about the kit's repositories. + The sub-tags store info about the kit's components. + +The data inside is returned as: + + + + ... + + + + ... + + ... + + + ... + + ... + + + +=item B<-V|--verbose> + +Display additional progress and error messages. + +=item B<-v|--version> + +Command Version. + +=item B<-?|-h|--help> + +Display usage message. + +=back + +=head1 RETURN VALUE + +=over 3 + +=item 0 +The command completed successfully. + +=item 1 +An error has occurred. + +=back + + +=head1 EXAMPLES + +=over 3 + +=item 1. +To list all kits, enter: + + lskit + +=item 2. +To list the kit "kit-test1-1.0-Linux", enter: + + lskit kit-test1-1.0-Linux + +=item 3. +To list the kit "kit-test1-1.0-Linux" for selected attributes, enter: + + lskit -K basename,description -R kitreponame -C kitcompname kit-test1-1.0-Linux + +=item 4. +To list the framework value of a Kit tarfile. + + lskit -F /myhome/mykits/pperte-1.3.0.2-0-x86_64.tar.bz2 + +Output is similar to: + + Extracting the kit.conf file from /myhome/mykits/pperte-1.3.0.2-0-x86_64.tar.bz2. Please wait. + + kitframework=2 + compatible_kitframeworks=0,1,2 + +=item 5. +To list kit "testkit-1.0-1" with XML tags, enter: + + XCATXMLTRACE=1 lskit -x testkit-1.0-1 + +=back + + +=head1 FILES + +/opt/xcat/bin/lskit + +=head1 SEE ALSO + +L, L, L, L, L, L + diff --git a/xCAT-client/pods/man1/lskitcomp.1.pod b/xCAT-client/pods/man1/lskitcomp.1.pod new file mode 100644 index 000000000..46a90fa3d --- /dev/null +++ b/xCAT-client/pods/man1/lskitcomp.1.pod @@ -0,0 +1,156 @@ +=head1 NAME + +B - Used to list information for one or more kit components. + + +=head1 SYNOPSIS + +B [B<-V> | B<--verbose>] [B<-x> | B<--xml> | B<--XML>] [B<-C> | B<--compattr> I] [B<-O> | B<--osdistro> I] [B<-S> | B<--serverrole> I] [I] + +B [B<-?> | B<-h> | B<--help> | B<-v> | B<--version>] + + +=head1 DESCRIPTION + +The B command is used to list information for one or more kit components. A kit is made up of one or more kit components. Each kit component is a meta package used to install a software product component on one or more nodes in an xCAT cluster. + +The B command outputs the kit component info in two formats: human-readable format (default), and XML format. Use the -x option to view the info in XML format. + +Input to the command can specify any number or combination of the input options. + +Note: The xCAT support for Kits is only available for Linux operating systems. + +=head1 OPTIONS + +=over 10 + +=item B<-C|--compattr> I + +where I is a comma-delimited list of kit component attribute names. The names correspond to attribute names in the B table. The B command will only display the specified kit component attributes. + +=item B<-O|--osdistro> I + +where I is the name of an osdistro in B table. The B command will only display the kit components matching the specified osdistro. + +=item B<-S|--serverrole> I + +where I is the name of a server role. The typical server roles are: mgtnode, servicenode, computenode, loginnode, storagennode. The B command will only display the kit components matching the specified server role. + +=item I + +is a comma-delimited list of kit component names. The B command will only display the kit components matching the specified names. + +=item B<-x|--xml|--XML> + +Need XCATXMLTRACE=1 env when using -x|--xml|--XML. +Return the output with XML tags. The data is returned as: + + + + ... + + + ... + + + ... + + + +Each tag contains info for a group of kit components belonging to the same kit. The info inside is structured as follows: + + The sub-tag contains the kit's name. + The sub-tags store info about the kit's components. + +The data inside is returned as: + + + + ... + + + + ... + + ... + + + +=item B<-V|--verbose> + +Display additional progress and error messages. + +=item B<-v|--version> + +Command Version. + +=item B<-?|-h|--help> + +Display usage message. + +=back + +=head1 RETURN VALUE + +=over 3 + +=item 0 +The command completed successfully. + +=item 1 +An error has occurred. + +=back + + +=head1 EXAMPLES + +=over 3 + +=item 1. + +To list all kit components, enter: + + lskitcomp + +=item 2. + +To list the kit component "comp-server-1.0-1-rhels-6-x86_64", enter: + + lskitcomp comp-server-1.0-1-rhels-6-x86_64 + +=item 3. + +To list the kit component "comp-server-1.0-1-rhels-6-x86_64" for selected kit component attributes, enter: + + lskitcomp -C kitcompname,desc comp-server-1.0-1-rhels-6-x86_64 + +=item 4. + +To list kit components compatible with "rhels-6.2-x86_64" osdistro, enter: + + lskitcomp -O rhels-6.2-x86_64 + +=item 5. + +To list kit components compatible with "rhels-6.2-x86_64" osdistro and "computenode" server role, enter: + + lskitcomp -O rhels-6.2-x86_64 -S computenode + +=item 6. + +To list the kit component "testkit-compute-1.0-1-ubuntu-14.04-ppc64el" with XML tags, enter: + + XCATXMLTRACE=1 lskitcomp -x testkit-compute-1.0-1-ubuntu-14.04-ppc64el + +=back + + +=head1 FILES + +/opt/xcat/bin/lskitcomp + +=head1 SEE ALSO + +L, L, L, L, L, L + diff --git a/xCAT-client/pods/man1/lskitdeployparam.1.pod b/xCAT-client/pods/man1/lskitdeployparam.1.pod new file mode 100644 index 000000000..1ce466a5c --- /dev/null +++ b/xCAT-client/pods/man1/lskitdeployparam.1.pod @@ -0,0 +1,107 @@ +=head1 NAME + +B - Lists the deployment parameters for one or more Kits or Kit components + + +=head1 SYNOPSIS + +B [B<-V> | B<--verbose>] [B<-x> | B<--xml> | B<--XML>] [B<-k> | B<--kitname> I] [B<-c> | B<--compname> I] + +B [B<-?> | B<-h> | B<--help> | B<-v> | B<--version>] + + +=head1 DESCRIPTION + +The B command is used to list the kit deployment parameters for one or more kits, or one or more kit components. Kit deployment parameters are used to customize the installation or upgrade of kit components. + +The B command outputs the kit component information in two formats: human-readable format (default), and XML format. Use the -x option to view the information in XML format. + +Input to the command can specify any combination of the input options. + +Note: The xCAT support for Kits is only available for Linux operating systems. + +=head1 OPTIONS + +=over 10 + +=item B<-k|--kitname> I + +Where I is a comma-delimited list of kit names. The B command will only display the deployment parameters for the kits with the matching names. + +=item B<-c|--compname> I + +Where I is a comma-delimited list of kit component names. The B command will only display the deployment parameters for the kit components with the matching names. + +=item B<-x|--xml|--XML> + +Return the output with XML tags. The data is returned as: + + + + KIT_KIT1_PARAM1 + value11 + + + + + KIT_KIT1_PARAM2 + value12 + + + ... + +=item B<-V|--verbose> + +Display additional progress and error messages. + +=item B<-v|--version> + +Command Version. + +=item B<-?|-h|--help> + +Display usage message. + +=back + + +=head1 RETURN VALUE + +=over 3 + +=item 0 +The command completed successfully. + +=item 1 +An error has occurred. + +=back + + +=head1 EXAMPLES + +=over 3 + +=item 1. + +To list kit deployment parameters for kit "kit-test1-1.0-Linux", enter: + + lskitdeployparam -k kit-test1-1.0-Linux + +=item 2. + +To list kit deployment parameters for kit component "comp-server-1.0-1-rhels-6-x86_64", enter: + + lskitdeployparam -c comp-server-1.0-1-rhels-6-x86_64 + +=back + + +=head1 FILES + +/opt/xcat/bin/lskitdeployparam + +=head1 SEE ALSO + +L, L, L, L, L, L + diff --git a/xCAT-client/pods/man1/rmkit.1.pod b/xCAT-client/pods/man1/rmkit.1.pod new file mode 100644 index 000000000..c9d8cb4a8 --- /dev/null +++ b/xCAT-client/pods/man1/rmkit.1.pod @@ -0,0 +1,83 @@ +=head1 NAME + +B - Remove Kits from xCAT + +=head1 SYNOPSIS + +B [B<-?>|B<-h>|B<--help>] [B<-v>|B<--version>] + +B [B<-V>|B<--verbose>] [B<-f>|B<--force>] [B<-t>|B<--test>] I + +=head1 DESCRIPTION + +The B command removes kits on the xCAT management node from kit names. + +Note: The xCAT support for Kits is only available for Linux operating systems. + +=head1 OPTIONS + +=over 10 + +=item B<-h|--help> + +Display usage message. + +=item B<-V|--verbose> + +Verbose mode. + +=item B<-v|--version> + +Command version. + +=item B<-f|--force> + +Remove this kit even there is any component in this kit is listed by osimage.kitcomponents. If this option is not specified, this kit will not be removed if any kit components listed in an osimage.kitcomponents + +=item B<-t|--test> + +Test if kitcomponents in this kit are used by osimage + +=item I + +A comma delimited list of kits that are to be removed from the xCAT cluster. Each entry can be a kitname or kit basename. For kit basename, rmkit command will remove all the kits that have that kit basename. + +=back + +=head1 RETURN VALUE + +0 The command completed successfully. + +1 An error has occurred. + +=head1 EXAMPLES + +1. To remove two kits from tarball files. + + rmkit kit-test1,kit-test2 + +Output is similar to: + + Kit kit-test1-1.0-Linux,kit-test2-1.0-Linux was successfully removed. + +2. To remove two kits from tarball files even the kit components in them are still being used by osimages. + + rmkit kit-test1,kit-test2 --force + +Output is similar to: + + Kit kit-test1-1.0-Linux,kit-test2-1.0-Linux was successfully removed. + +3. To list kitcomponents in this kit used by osimage + + rmkit kit-test1,kit-test2 -t + +Output is similar to: + + kit-test1-kitcomp-1.0-Linux is being used by osimage osimage-test + Following kitcomponents are in use: kit-test1-kitcomp-1.0-Linux + +=head1 SEE ALSO + +L, L, L, L, L + diff --git a/xCAT-client/pods/man1/rmkitcomp.1.pod b/xCAT-client/pods/man1/rmkitcomp.1.pod new file mode 100644 index 000000000..5484300dc --- /dev/null +++ b/xCAT-client/pods/man1/rmkitcomp.1.pod @@ -0,0 +1,90 @@ +=head1 NAME + +B - Remove Kit components from an xCAT osimage. + +=head1 SYNOPSIS + +B [B<-?>|B<-h>|B<--help>] [B<-v>|B<--version>] + +B [B<-V>|B<--verbose>] [B<-u>|B<--uninstall>] [B<-f>|B<--force>] [B<--noscripts>] B<-i> I I + +=head1 DESCRIPTION + +The B command removes kit components from an xCAT osimage. All the kit component attribute values that are contained in the osimage will be removed, and the kit component meta rpm and package rpm could be uninstalled by B<-u|--uninstall> option. + +Note: The xCAT support for Kits is only available for Linux operating systems. + +=head1 OPTIONS + +=over 10 + +=item B<-u|--uninstall> + +All the kit component meta rpms and package rpms in otherpkglist will be uninstalled during genimage for stateless image and updatenode for stateful nodes. + +=item B<-h|--help> + +Display usage message. + +=item B<-V|--verbose> + +Verbose mode. + +=item B<-v|--version> + +Command version. + +=item B<-f|--force> + +Remove this kit component from osimage no matter it is a dependency of other kit components. + +=item B<--noscripts> + +Do not remove kitcomponent's postbootscripts from osimage + +=item B<-i> I + +osimage name that include this kit component. + +=item I + +A comma-delimited list of valid full kit component names or kit component basenames that are to be removed from the osimage. If a basename is specified, all kitcomponents matching that basename will be removed from the osimage. + +=back + +=head1 RETURN VALUE + +0 The command completed successfully. + +1 An error has occurred. + +=head1 EXAMPLES + +1. To remove a kit component from osimage + + rmkitcomp -i rhels6.2-ppc64-netboot-compute comp-test1-1.0-1-rhels-6.2-ppc64 + +Output is similar to: + + kitcomponents comp-test1-1.0-1-rhels-6.2-ppc64 were removed from osimage rhels6.2-ppc64-netboot-compute successfully + +2. To remove a kit component even it is still used as a dependency of other kit component. + + rmkitcomp -f -i rhels6.2-ppc64-netboot-compute comp-test1-1.0-1-rhels-6.2-ppc64 + +Output is similar to: + + kitcomponents comp-test1-1.0-1-rhels-6.2-ppc64 were removed from osimage rhels6.2-ppc64-netboot-compute successfully + +3. To remove a kit component from osimage and also remove the kit component meta RPM and package RPM. So in next genimage for statelss image and updatenode for stateful nodes, the kit component meta RPM and package RPM will be uninstalled. + + rmkitcomp -u -i rhels6.2-ppc64-netboot-compute comp-test1-1.0-1-rhels-6.2-ppc64 + +Output is similar to: + + kitcomponents comp-test1-1.0-1-rhels-6.2-ppc64 were removed from osimage rhels6.2-ppc64-netboot-compute successfully + + +=head1 SEE ALSO + +L, L, L, L, L From 1ae5c2f0e6df991108094f6c3e44b77c2ab74f75 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 3 Oct 2019 11:46:20 -0400 Subject: [PATCH 27/58] Revert "Remove buildkit file" This reverts commit 6e168ebe71481711085bbfa72bc882f6fc4ae9f8. --- xCAT-buildkit/bin/buildkit | 4142 ++++++++++++++++++++++++++++++ xCAT-buildkit/xCAT-buildkit.spec | 14 + 2 files changed, 4156 insertions(+) create mode 100755 xCAT-buildkit/bin/buildkit diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit new file mode 100755 index 000000000..eb119cde1 --- /dev/null +++ b/xCAT-buildkit/bin/buildkit @@ -0,0 +1,4142 @@ +#!/usr/bin/env perl +# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +# + +#----------------------------------------------------------------------------- + +=head1 buildkit + + xCAT/PCM Kit Build utilities + +This script is designed to run on a non-xCAT system so that Kits can be +built on any product build machine. + +=cut + +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; + $::XCATDIR = $ENV{'XCATDIR'} ? $ENV{'XCATDIR'} : '/etc/xcat'; + $::XCATSHARE = $::XCATROOT . '/share/xcat'; +} + +if ($^O =~ /^aix/i) { + print "ERROR - the buildkit command is not supported on AIX \n"; + exit 1; +} + +use lib "$::XCATROOT/lib/perl"; +require xCAT::BuildKitUtils; +use Getopt::Long; +use strict; +use Cwd; +use Cwd 'abs_path'; +use File::Path; +use File::Basename; + +#----------------------------------------------------------------------------- +# Main + +$::progname = "buildkit"; +$::buildkit_conf = "buildkit.conf"; +$::kit_conf = "kit.conf"; +$::current_dir = cwd(); + +# this code will build a kit using framework 1. +$::KITFRAMEWORK = "2"; + +# this code is compatible with other kits that are at framework 0 or 1. +$::COMPATIBLE_KITFRAMEWORKS = "0,1,2"; + +%::buildkit_def = ( + kit => { basename => { + description => 'The kit base name (e.g., kit-lsf)', + value_desc => 'Must be: Generic Name String', + mandatory => 1, + cp_to_kitconfig => 1 }, + description => { + description => 'The kit description', + value_desc => 'any string', + mandatory => 0, + cp_to_kitconfig => 1 }, + version => { + description => 'The kit version (e.g., 9.0)', + value_desc => 'Must be: Generic Name String', + mandatory => 1, + cp_to_kitconfig => 1 }, + release => { + description => 'The kit release (e.g., 1)', + value_desc => 'Must be: Generic Name String', + mandatory => 0, + cp_to_kitconfig => 1 }, + ostype => { + description => 'The kit OS type (e.g., Linux)', + value_desc => 'Must be: OS Type String', + mandatory => 1, + cp_to_kitconfig => 1 }, + osbasename => { + description => 'The kit OS basename', + value_desc => 'Must be: Generic Name String', + mandatory => 0, + cp_to_kitconfig => 0 }, + osmajorversion => { + description => 'The kit OS majorversion', + value_desc => 'Must be: Generic Name String', + mandatory => 0, + cp_to_kitconfig => 0 }, + osminorversion => { + description => 'The kit OS minorversion', + value_desc => 'Must be: Generic Name String', + mandatory => 0, + cp_to_kitconfig => 0 }, + osarch => { + description => 'The kit OS architecture', + value_desc => 'Must be: Generic Name String', + mandatory => 0, + cp_to_kitconfig => 0 }, + isinternal => { + description => 'Flag to say if this Kit is used for internal use only. It is only used for information purposes.', + value_desc => 'Must be: empty string or boolean string', + mandatory => 0, + cp_to_kitconfig => 1 }, + kitdeployparams => { + description => 'The path to the Kit Deployment Parameters file.', + value_desc => 'Must be: empty string or relative path string', + mandatory => 0, + base_dir => 'other_files', + cp_to_kitconfig => 2 }, # 2 = rename with KIT_KITNAME_ on cp + kitlicense => { + description => 'The Kit license string to be built into all kitcomponent packages.', + value_desc => 'any string', + mandatory => 1, + cp_to_kitconfig => 0 }, + kittarfilename => { + description => 'The filename to use for the generated kit.', + value_desc => 'any string', + mandatory => 0, + cp_to_kitconfig => 0 }, + vendor => { + description => 'The Vendor value to use when building the rpms.', + value_desc => 'any string', + mandatory => 0, + cp_to_kitconfig => 0 }, + packager => { + description => 'The Packager value to use when building the rpms.', + value_desc => 'any string', + mandatory => 0, + cp_to_kitconfig => 0 }, + url => { + description => 'The URL value to use when building the rpms.', + value_desc => 'any string', + mandatory => 0, + cp_to_kitconfig => 0 } }, + kitrepo => { kitrepoid => { + description => 'The Kit Package Repository ID. (e.g., rhels-6.2-x86_64)', + value_desc => 'Must be: Generic Name String, unique in kit', + mandatory => 1, + cp_to_kitconfig => 0 }, + osbasename => { + description => 'The OS distro base name (e.g., rhels)', + value_desc => 'Must be OS Name String', + mandatory => 1, + cp_to_kitconfig => 1 }, + osmajorversion => { + description => 'The OS distro major version (e.g., 6)', + value_desc => 'Must be Generic Number String', + mandatory => 1, + cp_to_kitconfig => 1 }, + osminorversion => { + description => 'The OS distro minor version (e.g., 3)', + value_desc => 'Must be Generic Number String', + mandatory => 0, + cp_to_kitconfig => 1 }, + osarch => { + description => 'The OS distro architecture (e.g., x86_64)', + value_desc => 'Must be OS Arch String', + mandatory => 1, + cp_to_kitconfig => 1 }, + compat_osbasenames => { + description => 'Comma-separated list of compatible OS base names. ', + value_desc => 'Must be Empty String or list of OS Name Strings', + mandatory => 0, + cp_to_kitconfig => 1 } }, + kitcomponent => { basename => { + description => 'The component name. It is used as the meta-package name.', + value_desc => 'any string', + mandatory => 1, + cp_to_kitconfig => 1 }, + description => { + description => 'The component description. The description is added to the meta-package.', + value_desc => 'any string', + mandatory => 0, + cp_to_kitconfig => 1 }, + version => { + description => 'The component version (e.g., 9.0). It is used as the meta-package version.', + value_desc => 'any string', + mandatory => 0, + cp_to_kitconfig => 1 }, + release => { + description => 'The component release number (e.g., 1). It is used as the meta-package release number.', + value_desc => 'any string', + mandatory => 0, + cp_to_kitconfig => 1 }, + serverroles => { + description => 'tbd', + value_desc => 'any string', + mandatory => 1, + cp_to_kitconfig => 1 }, + kitrepoid => { + description => 'tbd', + value_desc => 'any string', + mandatory => 1, + cp_to_kitconfig => 0 }, + kitcompdeps => { + description => 'tbd', + value_desc => 'any string', + mandatory => 0, + cp_to_kitconfig => 1 }, + ospkgdeps => { + description => 'tbd', + value_desc => 'any string', + mandatory => 0, + cp_to_kitconfig => 0 }, + kitpkgdeps => { + description => 'tbd', + value_desc => 'any string', + mandatory => 0, + cp_to_kitconfig => 1 }, + non_native_pkgs => { + description => 'tbd', + value_desc => 'any string', + mandatory => 0, + cp_to_kitconfig => 0 }, + driverpacks => { + description => 'tbd', + value_desc => 'any string', + mandatory => 0, + cp_to_kitconfig => 1 }, + exlist => { + description => 'tbd', + value_desc => 'any string', + mandatory => 0, + base_dir => 'other_files', + cp_to_kitconfig => 2 }, + preinstall => { + description => 'tbd', + value_desc => 'any string', + mandatory => 0, + cp_to_kitconfig => 0 }, + postinstall => { + description => 'tbd', + value_desc => 'any string', + mandatory => 0, + cp_to_kitconfig => 0 }, + preuninstall => { + description => 'tbd', + value_desc => 'any string', + mandatory => 0, + cp_to_kitconfig => 0 }, + postuninstall => { + description => 'tbd', + value_desc => 'any string', + mandatory => 0, + cp_to_kitconfig => 0 }, + preupgrade => { + description => 'tbd', + value_desc => 'any string', + mandatory => 0, + cp_to_kitconfig => 0 }, + postupgrade => { + description => 'tbd', + value_desc => 'any string', + mandatory => 0, + cp_to_kitconfig => 0 }, + postbootscripts => { + description => 'tbd', + value_desc => 'any string', + mandatory => 0, + base_dir => 'scripts', + cp_to_kitconfig => 2 }, + genimage_postinstall => { + description => 'tbd', + value_desc => 'any string', + mandatory => 0, + base_dir => 'scripts', + cp_to_kitconfig => 2 } }, + kitpackage => { filename => { + description => 'tbd', + value_desc => 'any string', + mandatory => 1, + cp_to_kitconfig => 0 }, + kitrepoid => { + description => 'tbd', + value_desc => 'any string', + mandatory => 1, + cp_to_kitconfig => 0 }, + rpm_spec => { + description => 'tbd', + value_desc => 'any string', + mandatory => 0, + cp_to_kitconfig => 0 }, + rpm_srcdir => { + description => 'tbd', + value_desc => 'any string', + mandatory => 0, + cp_to_kitconfig => 0 }, + rpm_srctarball => { + description => 'tbd', + value_desc => 'any string', + mandatory => 0, + cp_to_kitconfig => 0 }, + rpm_srpm => { + description => 'tbd', + value_desc => 'any string', + mandatory => 0, + cp_to_kitconfig => 0 }, + rpm_prebuiltdir => { + description => 'tbd', + value_desc => 'any string', + mandatory => 0, + cp_to_kitconfig => 0 }, + isexternalpkg => { + description => 'tbd', + value_desc => 'any string', + mandatory => 0, + cp_to_kitconfig => 0 } } +); + + +my $args = join ' ', @ARGV; +$::command = "$0 $args"; +Getopt::Long::Configure("bundling"); +$Getopt::Long::ignorecase = 0; + +# parse the options +if ( + !GetOptions( + 'h|help' => \$::HELP, + 'v|version' => \$::VERSION, + 'V|verbose' => \$::VERBOSE, + 'n|noprerequisite' => \$::PREREQUISITE, + 'p|pkgdir=s' => \$::PKGDIR, + 'k|kitversion=s' => \$::KITVERSION, + 'r|kitrelease=s' => \$::KITRELEASE, + 'l|kitloc=s' => \$::KITLOC, + 'for=s' => \$::FOROSVERSARCH, + ) + ) +{ + &usage; + exit(1); +} + +# display the usage if -h or --help is specified +if ($::HELP) +{ + &usage; + exit(0); +} + +my $debianflag = 0; +my $dpkg_flag = '-uc -us'; +my $tempstring = xCAT::BuildKitUtils->osver(); +if ($tempstring =~ /debian/ || $tempstring =~ /ubuntu/) { + $debianflag = 1; +} + +# This is an undocumented flag to support our local build team +# to allow building Ubuntu kits on our RH build machines. +# It requires RH rpms such as dep, fakeroot, perl-File-DesktopEntry, +# perl-File-BaseDir, and html2text to be installed on the build server +# for this to work. To use this flag: +# buildkit --for ubuntu buildrepo +# buildkit --for ubuntu buildtar +if ($::FOROSVERSARCH) { + if ($::FOROSVERSARCH =~ /debian/ || $::FOROSVERSARCH =~ /ubuntu/) { + $debianflag = 1; + $dpkg_flag .= ' -A -d'; + } +} + +# display the version statement if -v or --version is specified +if ($::VERSION) +{ + my $versioncmd = "rpm -q --qf \"%{NAME}: %{VERSION}-%{RELEASE} \n\" xCAT-buildkit"; + my $message = "Error quering xCAT-buildkit rpm. Version info is not available. \n"; + if ($debianflag) { + + $versioncmd = "dpkg-query --show -f='\${binary:Package}: \${Version}\n' xcat-buildkit"; + $message = "Error quering xcat-buildkit package. Version info is not available. \n"; + } + if (system($versioncmd)) { + + # non-zero return from system call + print $message; + exit 1; + } + + # add framework info to output + print "\tkitframework = $::KITFRAMEWORK\n"; + print "\tcompatible_frameworks = $::COMPATIBLE_KITFRAMEWORKS\n"; + + exit 0; +} + +my $arg = shift(@ARGV); +if (!$arg) { + &usage; + exit(0); +} + +# set kit location +if ($::KITLOC) { + $::workdir = $::KITLOC; + $::current_dir = $::workdir; +} else { + $::workdir = $::current_dir; +} + +$::full_buildkit_conf = $::workdir . "/" . $::buildkit_conf; +$::build_dir = $::workdir . "/build"; +$::deploy_dir = $::build_dir; #kitname appended by validate_bldkitconf routine +$::base_repodir = $::build_dir . "/kit_repodir"; + +while ($arg) { + my $command = $arg; + $command =~ tr/A-Z/a-z/; # convert to lowercase + if ($command eq 'create') { + $::KIT_CREATE = shift(@ARGV); + if ($::KITLOC) { + $::workdir = dirname($::KITLOC); + $::current_dir = $::workdir; + } + if (!$::KIT_CREATE) { + print "The Kit basename was not specified for the buildkit create command.\n"; + &usage; + exit 1; + } + } elsif ($command eq 'chkconfig') { + $::KIT_CHKCONFIG = 1; + } elsif ($command eq 'buildrepo') { + $::KIT_BUILDREPO = shift(@ARGV); + if (!$::KIT_BUILDREPO) { + print "The Kit package repository name was not specified for buildkit buildrepo command.\n"; + &usage; + exit 1; + } + } elsif ($command eq 'listrepo') { + $::KIT_LISTREPO = 1; + } elsif ($command eq 'cleanrepo') { + $::KIT_CLEANREPO = shift(@ARGV); + if (!$::KIT_CLEANREPO) { + print "kit package repository name not specified for buildkit cleanrepo command \n"; + &usage; + exit 1; + } + } elsif ($command eq 'buildtar') { + $::KIT_BUILDTAR = 1; + } elsif ($command eq 'cleantar') { + $::KIT_CLEANTAR = 1; + } elsif ($command eq 'cleanall') { + $::KIT_CLEANALL = 1; + } elsif ($command eq 'addpkgs') { + $::KIT_ADDPKGS = shift(@ARGV); + if (!($::KIT_ADDPKGS)) { + print "Missing parameter: the name must be specified when using the \'buildkit addpkgs\' command.\n"; + &usage; + exit(1); + } + if (!($::PKGDIR)) { + print "Missing option: the -p option must be specified with \'buildkit addpkgs\' command. \n"; + &usage; + exit(1); + } + } else { + print "The buildkit command $arg is not recognized.\n"; + &usage; + exit(1); + } + $arg = shift(@ARGV); +} + +my $rc = 0; +if ($::KIT_CREATE) { + $rc = &kit_create; +} +if ($::KIT_CHKCONFIG) { + unless ($rc = &kit_chkconfig) { + print "No errors were found in Kit Build File $::full_buildkit_conf. \n"; + } +} +if ($::KIT_LISTREPO) { + unless ($rc = &kit_chkconfig) { $rc = &kit_listrepo; } +} +if ($::KIT_BUILDREPO) { + unless ($rc = &kit_chkconfig) { $rc = &kit_buildrepo; } +} +if ($::KIT_CLEANREPO) { + unless ($rc = &kit_chkconfig) { $rc = &kit_cleanrepo; } +} +if ($::KIT_BUILDTAR) { + unless ($rc = &kit_chkconfig) { $rc = &kit_buildtar; } +} +if ($::KIT_CLEANTAR) { + unless ($rc = &kit_chkconfig) { $rc = &kit_cleantar; } +} +if ($::KIT_CLEANALL) { + unless ($rc = &kit_chkconfig) { $rc = &kit_cleanall; } +} +if ($::KIT_ADDPKGS) { $rc = &kit_addpkgs; } + +exit $rc; + +##################################### +# subroutines +##################################### + +#----------------------------------------------------------------------------- + +=head3 usage + + Displays message for -h option + +=cut + +#----------------------------------------------------------------------------- +sub usage +{ + print "Usage: + buildkit [-?│-h│--help] [-v│--version] + + To build a new Kit + + buildkit [-V│--verbose] [] [│all] + [-l│--kitloc ] + + To add packages to an existing Kit. + + buildkit [-V│--verbose] addpkgs [-p│--pkgdir ] [-k│--kitversion ] [-r│--kitrelease ] + + This tool is used to build and manage a Kit package. + The options are: + -h - Provide usage info. + -k - Kit version. + -l - Location of kit files. (Including kit name.) + -p - RPM package directory locations. + -r - Kit release. + -v - Provide the version info. + command - Several commands are supported. See the list below. + -V - Verbose mode. Outputs additional debug messages. + + Supported subcommands: + create - creates a new Kit with the specified basename + chkconfig - checks the Kit build file + listrepo - lists the Kit package repositories in the Kit + build file, and their build status + buildrepo - builds the specified Kit package repository + buildrepo all - builds all the Kit package repositories + cleanrepo - deletes the build files for the specified Kit + package repository + cleanrepo all - deletes the build files for all Kit package + repositories + buildtar - builds the Kit tarfile + cleantar - deletes the Kit deployment directory and Kit + tarfile + cleanall - equivalent to buildkit cleanrepo all and + buildkit cleantar + addpkgs -p + - add product package rpms to a shipped tarfile + named kitname.NEEDS_PRODUCT_PKGS.tar.bz2 + \n"; +} + +#----------------------------------------------------------------------------- + +=head3 kit_create + + buildkit create + +=cut + +#----------------------------------------------------------------------------- + +sub kit_create + +{ + # create Kit directory in pwd + my $kitname = $::KIT_CREATE; + my $kitdir; + if ($::KITLOC) { + $kitdir = $::KITLOC; + } else { + $kitdir = $::workdir . "/$kitname"; + } + + if (-d $kitdir) { + print "Another directory already exists with the name $kitdir. Not able to create new Kit. \n"; + exit 1; + } + if (!mkdir($kitdir)) { + print "Error creating Kit directory $kitdir. Verify that the current user has privileges to create the directory. \n"; + exit 1; + } + + # Recursive copy the shipped template directory to the Kit directory + if (system("cp -fRp $::XCATSHARE/kits/kit_template/* $kitdir")) { + + # non-zero return from system call + print "Error copying sample Kit template files from $::XCAT_SHARE/kits/kit_template to $kitdir \n"; + exit 1; + } + + if (&edit_bldkitconf($kitdir . "/" . $::buildkit_conf, $kitname)) { + exit 1; + } + + print "Kit template for $kitname created in $kitdir directory \n"; + return 0; +} + +#----------------------------------------------------------------------------- + +=head3 kit_chkconfig + + buildkit chkconfig + +=cut + +#----------------------------------------------------------------------------- + +sub kit_chkconfig + +{ + if ($::CHKCONFIG_DONE) { return 0; } + my $bldkitconf = $::full_buildkit_conf; + + my $chkrc = &load_bldkitconf($bldkitconf); + if ($chkrc != 0) { return 1; } + + $chkrc = &validate_bldkitconf(); + if ($chkrc != 0) { return 1; } + + $::CHKCONFIG_DONE = 1; + return 0; +} + +#----------------------------------------------------------------------------- + +=head3 kit_buildrepo + + buildkit buildrepo + +=cut + +#----------------------------------------------------------------------------- + +sub kit_buildrepo +{ + my $rc = 0; + my $repoid = $::KIT_BUILDREPO; + + if (!$debianflag) { + + # Check if createrepo exists or not. Fail at the beginning. + #- don't use specific path - may not be correct in build env + my $rcmd = "createrepo -h > /dev/null"; + if (system($rcmd )) { + print "Error: the createrepo command does not seem to be installed. Make sure createrepo is installed before running the buildkit command. \n"; + return 1; + } + } + + $repoid =~ s/\s+//g; + $repoid =~ tr/A-Z/a-z/; # convert to lowercase + if ($repoid ne 'all') { + return &kit_buildrepo1($::KIT_BUILDREPO); + } else { + foreach my $kr (@{ $::bldkit_config->{kitrepo}{entries} }) { + if (&kit_buildrepo1($kr->{kitrepoid})) { return 1; } + } + } + return $rc; +} + +#----------------------------------------------------------------------------- + +=head3 kit_buildrepo1 + + + +=cut + +#----------------------------------------------------------------------------- +sub kit_buildrepo1 +{ + my $rc = 0; + my $repoid = shift; + $repoid =~ s/\s+//g; + my $repodir = $::base_repodir; + my $srcdir = $::workdir . "/source_packages/"; + my $basedir = $repodir; + my $repo; + + # find the repo + my $found = 0; + foreach my $kr (@{ $::bldkit_config->{kitrepo}{entries} }) { + if ($kr->{kitrepoid} eq $repoid) { + $found = 1; + $repo = $kr; + if (&validate_os($kr)) { + print "The buildrepo operation will continue, but errors may occur. You may need to run this command on a host with the same OS.\n"; + } + $repodir .= "/$kr->{kitreponame}"; + last; + } + } + if (!$found) { + print "The specified Kit Package Repository \"$repoid\" does not exist in the Kit Build File. \n"; + return 1; + } + + # Create repo build directory + if ((!-d $repodir) && (!mkpath($repodir))) { + print "Error creating build repository directory $repodir.\n"; + return 1; + } + + # Build kitpackages first + my $kitrepohash; + foreach my $kr (@{ $::bldkit_config->{kitrepo}{entries} }) { + $kitrepohash->{ $kr->{kitrepoid} } = $kr->{kitreponame}; + } + + foreach my $kp (@{ $::bldkit_config->{kitpackage}{entries} }) { + + # For this kitrepo? + my $found = 0; + foreach my $kprid (split(/,/, $kp->{kitrepoid})) { + $kprid =~ s/\s+//g; + if ($repoid eq $kprid) { + $found = 1; + last; + } + } + if (!$found) { next; } + + # is this package already built? + my $rpm = "$repodir/$kp->{filename}"; + if (-r $rpm) { next; } + + my $kprid; + my $rpm_built; + foreach $kprid (split(/,/, $kp->{kitrepoid})) { + if ($repoid eq $kprid) { + next; + } + if ((-d "$basedir/$kitrepohash->{$kprid}") and (-f "$basedir/$kitrepohash->{$kprid}/$kp->{filename}")) { + $rpm_built = $kitrepohash->{$kprid}; + last; + } + } + + + # determine build method + if ($kp->{isexternalpkg} eq 'yes') { + if ($::VERBOSE) { print "skipping build of external kitpackage $kp->{filename} \n"; } + next; + } else { + if ($::VERBOSE) { print "building kitpackage $kp->{filename} \n"; } + } + if (defined($kp->{rpm_prebuiltdir})) { + + # simply copy the file to the build directory + my $full_prebuiltrpm = $srcdir . $kp->{rpm_prebuiltdir} . "/" . $kp->{filename}; + + if ($rpm_built) { + if (system("cd $repodir;ln -sf ../$rpm_built/$kp->{filename} $kp->{filename}")) { + + # non-zero return from system call + print "Error create symlink for prebuilt rpm $kp->{filename} to Kit Build directory. \n"; + return; + } + } else { + if (system("cp -fp $full_prebuiltrpm $repodir")) { + + # non-zero return from system call + print "Error copying prebuilt rpm $kp->{filename} to Kit Build directory. \n"; + return 1; + } + } + } elsif (defined($kp->{rpm_srpm})) { + + # run rpmbuild --rebuild on the source rpm + print "SKIPPING BUILD FOR KIT PACKAGE $kp->{filename} \n"; + print "TBD - only buildrepo for prebuilt rpms is available at this time \n\n"; + } elsif (defined($kp->{rpm_srctarball}) && + defined($kp->{rpm_spec})) { + + # run rpmbuild + print "SKIPPING BUILD FOR KIT PACKAGE $kp->{filename} \n"; + print "TBD - only buildrepo for prebuilt rpms is available at this time \n\n"; + } elsif (defined($kp->{rpm_srcdir}) && + defined($kp->{rpm_spec})) { + + # build tarfile and run rpmbuild + print "SKIPPING BUILD FOR KIT PACKAGE $kp->{filename} \n"; + print "TBD - only buildrepo for prebuilt rpms is available at this time \n\n"; + } else { + print "Cannot determine build method for Kit Package $kp->{filename}. Verify that your Kit Build File is correct. \n"; + return 1; + } + } + + # Build kitcomponent preppackages and metapackages + if ($debianflag) { + foreach my $kc (@{ $::bldkit_config->{kitcomponent}{entries} }) { + if ($repoid ne $kc->{kitrepoid}) { next; } + my $debname = "$repodir/" . &comppkgname($kc); + if (-r $debname) { next; } + if ($::VERBOSE) { print "building kitcomponent package for $kc->{basename} \n"; } + if (&build_kitcomp_debian($kc)) { + print "Error building kitcomponent metapackage for $kc->{basename} \n"; + return 1; + } + } + + if (system("cd $repodir;dpkg-scanpackages . > Packages")) { + print "Error building the repository meta-data with the dpkg-scanpackages command \n"; + return 1; + } + } + else { + foreach my $kc (@{ $::bldkit_config->{kitcomponent}{entries} }) { + + # Check if this kitcomponent is in the requested repo + if ($repoid ne $kc->{kitrepoid}) { next; } + + # Check if already built + my $rpm = "$repodir/" . &comppkgname($kc); + if (-r $rpm) { next; } + + # Build it + if ($::VERBOSE) { print "building kitcomponent metapackage for $kc->{basename} \n"; } + if (&build_kitcomp($kc)) { + print "Error building kitcomponent metapackage for $kc->{basename} \n"; + return 1; + } + } + + # run createrepo + my $cr_opts = ''; + if (($repo->{osbasename} =~ m/rh|RH|centos|CentOS/) && + ($repo->{osmajorversion} eq '5')) { + $cr_opts = '-s md5'; + } + if (system("createrepo $cr_opts $repodir")) { + print "Error building the repository meta-data with the createrepo command \n"; + return 1; + } + } + return 0; +} + +#----------------------------------------------------------------------------- + +=head3 kit_listrepo + + buildkit listrepo + +=cut + +#----------------------------------------------------------------------------- +sub kit_listrepo +{ + # print "Kit Repository: Status \n"; + foreach my $kr (@{ $::bldkit_config->{kitrepo}{entries} }) { + my $rc = 0; + my $status = "NOT DONE"; + unless ($rc = &validate_repo($kr)) { $status = "DONE"; } + print "$kr->{kitrepoid}: $status \n"; + } + + return 0; +} + +#----------------------------------------------------------------------------- + +=head3 kit_cleanrepo + + buildkit cleanrepo + +=cut + +#----------------------------------------------------------------------------- +sub kit_cleanrepo +{ + my $repoid = $::KIT_CLEANREPO; + my $tmp_repoid = $repoid; + $tmp_repoid =~ tr/A-Z/a-z/; # convert to lowercase + + if (($tmp_repoid eq 'all') && + -d $::base_repodir) { + if (system("rm -Rf $::base_repodir ")) { + print "Error removing contents of $::base_repodir \n"; + return 1; + } else { + print "Contents of $::base_repodir has been successfully removed. \n"; + } + } else { + my $got_one = 0; + foreach my $kr (@{ $::bldkit_config->{kitrepo}{entries} }) { + if ($repoid eq $kr->{kitrepoid}) { + my $repodir = $::base_repodir . '/' . $kr->{kitreponame}; + if (-d $repodir) { + if (system("rm -Rf $repodir ")) { + print "Error removing directory $repodir \n"; + return 1; + } else { + print "Kit repository $kr->{kitrepoid} has been removed. \n"; + } + } else { + print "Kit repository $kr->{kitrepoid} directory $repodir does not exist. Nothing to remove for this repository. \n"; + } + $got_one = 1; + last; + } + } + if (!$got_one) { + print "Kit repository $repoid does not exist.\n"; + return 1; + } + } + if (-d "$::workdir/rpmbuild") { + system("rm -Rf $::workdir/rpmbuild "); + } + if (-d "$::workdir/tmp") { + system("rm -Rf $::workdir/tmp "); + } + if (-d "$::workdir/debbuild") { + system("rm -Rf $::workdir/debbuild"); + } + + return 0; +} + +#----------------------------------------------------------------------------- + +=head3 kit_buildtar + + buildkit buildtar + +=cut + +#----------------------------------------------------------------------------- +sub kit_buildtar +{ + foreach my $kr (@{ $::bldkit_config->{kitrepo}{entries} }) { + if (&validate_repo($kr)) { + print "Kit Repository $kr->{kitrepoid} not built. Run: \n"; + print " buildkit buildrepo $kr->{kitrepoid} \n"; + return 1; + } + } + + if (&create_kitconf) { + print "Error creating kit configuration file \n"; + return 1; + } + + if ($::HAVE_EXTERNAL_PKG or $::HAVE_NON_NATIVE_PKGS) { + if (&create_PARTIAL_builddir) { + print "Error creating PARTIAL kit build directory contents \n"; + return 1; + } + } else { + if (&create_builddir) { + print "Error creating kit build directory contents \n"; + return 1; + } + } + + if (!-d "$::deploy_dir/repos") { + symlink "$::build_dir/kit_repodir", "$::deploy_dir/repos"; + } + + # build the tarfile + my $extpkgs = ''; + if ($::HAVE_EXTERNAL_PKG or $::HAVE_NON_NATIVE_PKGS) { + $extpkgs = '.NEED_PRODUCT_PKGS'; + } + my $kitname = $::bldkit_config->{kit}{entries}[0]->{kitname}; + my $kitfilename = $kitname; + if (defined($::bldkit_config->{kit}{entries}[0]->{kittarfilename})) { + $kitfilename = $::bldkit_config->{kit}{entries}[0]->{kittarfilename}; + $kitfilename =~ s/tar\.bz2\s*$//; + } + $kitfilename = $kitfilename . $extpkgs . ".tar.bz2"; + + my $tarfile = $::deploy_dir . "/" . $kitfilename; + + my $dir = dirname($::deploy_dir); + my $bidir = "$dir/build_input"; + + #It is for partial kit. + if ($::HAVE_EXTERNAL_PKG or $::HAVE_NON_NATIVE_PKGS) { + if (-d "$bidir") { + if (system("cd $::deploy_dir; cd ..; cp -r build_input $kitname")) { + print "Error: Could not copy building tarfile $tarfile \n"; + return 1; + } + } + } else { + + #If it is complete kit and there is build_input directory in deploy_dir + #If there is tmp rpmbuild source_packages + #delete them from complete kit build_input + if (-d "$bidir") { + if (system("cd $::deploy_dir; cd ..; rm -fr build_input/tmp")) { + print "Error:Could not delete build_input/tmp \n"; + } + if (system("cd $::deploy_dir; cd ..; rm -fr build_input/rpmbuild")) { + print "Error:Could not delete build_input/tmp \n"; + } + if (system("cd $::deploy_dir; cd ..; rm -fr build_input/source_packages")) { + print "Error:Could not delete build_input/source_packages \n"; + } + if (system("cd $::deploy_dir; cd ..; cp -fr build_input $kitname")) { + print "Error: Could not copy building tarfile $tarfile \n"; + return 1; + } + } else { + + #If kit build dir is new created + #partial kit is never created before + #make sure there is build_input dir in complete kit dir + if (system("cd $::deploy_dir; mkdir -p build_input")) { + print "Error creating kit build directory contents \n"; + return 1; + } + if (system("cd $::deploy_dir; cp -fp $::workdir/buildkit.conf build_input")) { + print "Error creating kit build directory contents \n"; + return 1; + } + if (system("cd $::deploy_dir; cp -frp $::workdir/other_files build_input")) { + print "Error creating kit build directory contents \n"; + return 1; + } + if (system("cd $::deploy_dir; cp -frp $::workdir/plugins build_input")) { + print "Error creating kit build directory contents \n"; + return 1; + } + if (system("cd $::deploy_dir; cp -frp $::workdir/scripts build_input")) { + print "Error creating kit build directory contents \n"; + return 1; + } + } + } + + print "Creating tar file $::current_dir/$kitfilename.\n"; + + if (system("cd $::deploy_dir; cd ..; tar -cjhf $tarfile $kitname/*")) { + print "Error building tarfile $tarfile \n"; + return 1; + } + + system("mv $tarfile $::current_dir"); + print "Kit tar file $::current_dir/$kitfilename successfully built. \n"; + return 0; +} + +#----------------------------------------------------------------------------- + +=head3 kit_cleantar + + buildkit cleantar + + Remove tar files from the kit location directory. + + This removes all tar files - not just the last one created! + + Also clean up several other files/dirs + +=cut + +#----------------------------------------------------------------------------- +sub kit_cleantar +{ + my $basename = $::bldkit_config->{kit}{entries}[0]->{basename}; + my $rmfiles = "$basename\*tar.bz2"; + + my $tarfile = "$::workdir/$rmfiles"; + + if ($rmfiles) { + if (system("rm -f $tarfile ")) { + print "Error removing kit tar files in $::workdir.\n"; + } else { + print "Kit tar files have been successfully removed from $::workdir.\n"; + } + } + + if (-d $::deploy_dir) { + if (system("rm -Rf $::deploy_dir ")) { + print "Error removing contents of $::deploy_dir \n"; + } else { + print "Removed $::deploy_dir.\n"; + } + } + if (-d "$::workdir/rpmbuild") { + if (system("rm -Rf $::workdir/rpmbuild ")) { + + # print "Error removing $::workdir/rpmbuild\n"; + } else { + print "Removed $::workdir/rpmbuild\n"; + } + } + if (-d "$::workdir/tmp") { + if (system("rm -Rf $::workdir/tmp ")) { + + # print "Error removing $::workdir/tmp \n"; + } else { + print "Removed $::workdir/tmp \n"; + } + } + if (-d "$::workdir/debbuild") { + if (system("rm -Rf $::workdir/debbuild")) { + + # print "Error removing $::workdir/debbuild.\n"; + } else { + print "Removed $::workdir/debbuild\n"; + } + } + return 0; +} + +#----------------------------------------------------------------------------- + +=head3 kit_cleanall + + buildkit cleanall + +=cut + +#----------------------------------------------------------------------------- +sub kit_cleanall +{ + print "Running buildkit cleanall... \n"; + + &kit_cleantar; + + if (-d $::build_dir) { + if (system("rm -Rf $::build_dir/* ")) { + print "Error removing contents of $::build_dir \n"; + } else { + print "All $::build_dir contents have been successfully removed \n"; + } + } + if (-d "$::workdir/rpmbuild") { + system("rm -Rf $::workdir/rpmbuild "); + } + if (-d "$::workdir/tmp") { + system("rm -Rf $::workdir/tmp "); + } + if (-d "$::workdir/debbuild") { + system("rm -Rf $::workdir/debbuild"); + } + + return 0; +} + +#----------------------------------------------------------------------------- + +=head3 edit_bldkitconf + + edit the shipped template buildkit.conf file to insert initial values + for the new kit +=cut + +#----------------------------------------------------------------------------- +sub edit_bldkitconf +{ + my $bldkitconf = shift; + my $kitname = shift; + + # read in the buildkit.conf file + my $CF; + unless (open($CF, "<", $bldkitconf)) { + print "The Kit build file $bldkitconf does not exist. \n"; + return 1; + } + if ($::VERBOSE) { + print "Reading kit configuration file $bldkitconf \n"; + } + my @lines = <$CF>; + close $CF; + + my $osinfo = xCAT::BuildKitUtils->osver(); + my $kitrepoid = $osinfo; + $kitrepoid =~ s/\,//; + my ($osbasename, $osmore) = split(/\,/, $osinfo); + my ($osmajorversion, $osminorversion) = split(/\./, $osmore); + my $osarch = `uname -p`; + chomp($osarch); + my $kitcomponent_basename = $kitname . "_compute"; + + if ($debianflag == 1) { + if ($osarch eq "ppc64le") { + $osarch = "ppc64el"; + } + $kitcomponent_basename = $kitname . "-compute"; + } + + for (@lines) { + s/<<>>/$kitname/; + s/<<>>/$kitrepoid/; + s/<<>>/$osbasename/; + s/<<>>/$osmajorversion/; + s/<<>>/$osminorversion/; + s/<<>>/$osarch/; + s/<<>>/$kitcomponent_basename/; + if ($debianflag) { + s/(filename=.*?)\-(.*)\.noarch\.rpm/$1_$2_all.deb/; + } + if ($osbasename =~ /rh/) { + s/.*<<>>/ compat_osbasenames=centos/; + } + } + + # Write the buildkit.conf back out + my $NCF; + unless (open($NCF, ">$bldkitconf")) { + return 1; + } + if ($::VERBOSE) { + print "Inserted initial values into $bldkitconf \n"; + } + print $NCF @lines; + close($NCF); + + return 0; +} + +#----------------------------------------------------------------------------- + +=head3 load_bldkitconf + + load the kitbuild.conf file into a global data structure and + verify that the general syntax is correct. + +=cut + +#----------------------------------------------------------------------------- +sub load_bldkitconf +{ + my $bldkitconf = shift; + + # read in the buildkit.conf file + my $CF; + unless (open($CF, "<", $bldkitconf)) { + print "The Kit build file $bldkitconf does not exist in the current directory. \n"; + return 1; + } + if ($::VERBOSE) { + print "Reading kit configuration file $bldkitconf \n"; + } + my @lines = <$CF>; + close $CF; + + my $current_section = 'no section'; + my %current_entry; + my $syntax_error = ''; + my $bad_line = ''; + my $line_number = 0; + foreach my $l (@lines) { + $line_number++; + + # skip blank and comment lines + next if ($l =~ /^\s*$/ || $l =~ /^\s*#/); + + # process a real line + # new section? + if ($l =~ /^\s*(\w+)\s*:/) { + my $section = $1; + if (defined($::buildkit_def{$section})) { + if (($section eq 'kit') && + ($::bldkit_config->{$section}{'exists'})) { + $syntax_error = "More than one \"$section:\" section exists "; + $bad_line = $l; + last; + } + $::bldkit_config->{$section}{'exists'} = 1; + push(@{ $::bldkit_config->{$current_section}{'entries'} }, {%current_entry}); + $current_section = $section; + undef %current_entry; + next; + } + } + if ($l =~ /^\s*(\w+)\s*=\s*(.*)\s*/) { + my $attr = $1; + my $val = $2; + my $orig_attr = $attr; + my $orig_val = $val; + $attr =~ s/^\s*//; # Remove any leading whitespace + $attr =~ s/\s*$//; # Remove any trailing whitespace + $attr =~ tr/A-Z/a-z/; # Convert to lowercase + $val =~ s/^\s*//; + $val =~ s/\s*$//; + + if (defined($::buildkit_def{$current_section}{$attr})) { + if ($val ne '') { $current_entry{$attr} = $val; } + } else { + if ($current_section eq 'no section') { + $syntax_error = "No section specified for attribute $attr."; + } else { + my $valid_attrs = join(', ', (keys(%{ $::buildkit_def{$current_section} }))); + $syntax_error = "Attribute \"$attr\" is not valid for section \"$current_section\". Valid attributes are: $valid_attrs.\n"; + } + $bad_line = $l; + last; + } + + } else { + $syntax_error = "Invalid line format"; + $bad_line = $l; + last; + + } + } + + # Need at least one kit and one kitrepo section + if (!$syntax_error) { + if (!($::bldkit_config->{'kit'}{'exists'})) { + $syntax_error = "No \"kit:\" section found. At least one section required. "; + $bad_line = ''; + } elsif (!($::bldkit_config->{'kitrepo'}{'exists'})) { + $syntax_error = "No \"kitrepo:\" section found. At least one section required. "; + $bad_line = ''; + } else { + push(@{ $::bldkit_config->{$current_section}{'entries'} }, {%current_entry}); + } + } + + if ($syntax_error) { + print "Error processing file $bldkitconf \n"; + print "Syntax error found on line $line_number:\n"; + print "$bad_line \n"; + print "$syntax_error \n"; + print "\n"; + print "The Kit build file does not have the correct format. \n"; + print "The format should be: \n"; + print "
: \n"; + print " = \n"; + print " = \n"; + print " ... \n"; + print "
: \n"; + print " = \n"; + print " = \n"; + print " ... \n"; + print "The valid section names are: kit, kitrepo, kitcomponent, kitpackages. \n"; + print "There must be exactly one kit, and must be at least one kitrepo section. \n"; + return 1; + } + + # Check for mandatory attributes + foreach my $s (keys %{$::bldkit_config}) { + if (!defined($::buildkit_def{$s})) { next; } + foreach my $se (@{ $::bldkit_config->{$s}{entries} }) { + foreach my $a (keys %{ $::buildkit_def{$s} }) { + if (($::buildkit_def{$s}{$a}->{mandatory}) && + (!defined($se->{$a}))) { + print "The \"$a\" mandatory attribute must be defined in the \"$s\" section of the Kit build file \n"; + return 1; + } + } + } + } + + #use Data::Dumper; + #print Dumper($::bldkit_config); + + return 0; +} + +#----------------------------------------------------------------------------- + +=head3 validate_bldkitconf + + validate the loaded buildkit configuration data + +=cut + +#----------------------------------------------------------------------------- +sub validate_bldkitconf +{ + my $kitname = $::bldkit_config->{kit}{entries}[0]->{basename}; + my $full_kitname = $kitname; + $full_kitname .= '-' . $::bldkit_config->{kit}{entries}[0]->{version}; + if (defined($::bldkit_config->{kit}{entries}[0]->{release})) { + $full_kitname .= '-' . $::bldkit_config->{kit}{entries}[0]->{release}; + } + my $short_kitname = $full_kitname; + if (defined($::bldkit_config->{kit}{entries}[0]->{osbasename})) { + $full_kitname .= '-' . $::bldkit_config->{kit}{entries}[0]->{osbasename}; + } + if (defined($::bldkit_config->{kit}{entries}[0]->{osmajorversion})) { + if (!defined($::bldkit_config->{kit}{entries}[0]->{osbasename})) { + print "Error: Kit osmajorversion attribute was specified but Kit osbasename was not set. \n"; + return 1; + } + $full_kitname .= '-' . $::bldkit_config->{kit}{entries}[0]->{osmajorversion}; + } + if (defined($::bldkit_config->{kit}{entries}[0]->{osminorversion})) { + my $kitminor = $::bldkit_config->{kit}{entries}[0]->{osminorversion}; + unless ($kitminor =~ /^\d/) { + $kitminor = split /<=|>=|==|<|>|=/, $::bldkit_config->{kit}{entries}[0]->{osminorversion}; + } + if ((!defined($::bldkit_config->{kit}{entries}[0]->{osbasename})) || + (!defined($::bldkit_config->{kit}{entries}[0]->{osmajorversion}))) { + print "Error: Kit osminorversion attribute was specified but either Kit osbasename or Kit osmajorversion were not set. \n"; + return 1; + } + $full_kitname .= '-' . $kitminor; + } + if (defined($::bldkit_config->{kit}{entries}[0]->{osarch})) { + $full_kitname .= '-' . $::bldkit_config->{kit}{entries}[0]->{osarch}; + } + $::bldkit_config->{kit}{entries}[0]->{kitname} = $full_kitname; + $::deploy_dir .= "/" . $full_kitname; + + # Make sure each kit kitdeployparams file exists + if (defined($::bldkit_config->{kit}{entries}[0]->{kitdeployparams})) { + my $kd_file = $::workdir . "/other_files/" . $::bldkit_config->{kit}{entries}[0]->{kitdeployparams}; + if (!-r $kd_file) { + print "Kit Deployment Parameters file $kd_file does not exist or is not readable\n"; + return 1; + } + if (&edit_deployparams($kd_file, 1)) { return 1; } + } + + # Make sure each kitrepo has unique distro info + my $kr_count = scalar @{ $::bldkit_config->{kitrepo}{entries} }; + if ($kr_count > 1) { + foreach my $kri (0 .. $kr_count - 2) { + foreach my $kri2 ($kri + 1 .. $kr_count - 1) { + my $kr = $::bldkit_config->{kitrepo}{entries}[$kri]; + my $kr2 = $::bldkit_config->{kitrepo}{entries}[$kri2]; + if ($kr->{kitrepoid} eq $kr2->{kitrepoid}) { + print "There are two or more kitrepo sections with the same kitrepoid \"$kr->{kitrepoid}\". \n"; + return 1; + } + if (($kr->{osbasename} eq $kr2->{osbasename}) && + ($kr->{osmajorversion} eq $kr2->{osmajorversion}) && + ($kr->{osarch} eq $kr2->{osarch})) { + if ((defined($kr->{osminorversion}) && + defined($kr2->{osminorversion}) && + ($kr->{osminorversion} eq $kr2->{osminorversion})) || + (!defined($kr->{osminorversion}) && + !defined($kr2->{osminorversion}))) { + print "There are two or more kitrepo sections which are defined with the same OS name, major/minor version, and architecture. \n"; + return 1; + } + } + } + } + } + + # Kitcomponent version/release are now optional - + # default to kit version/release + foreach my $kc (@{ $::bldkit_config->{kitcomponent}{entries} }) { + if (!defined($kc->{version})) { + $kc->{version} = $::bldkit_config->{kit}{entries}[0]->{version}; + } + if (!defined($kc->{release})) { + if (!defined($::bldkit_config->{kit}{entries}[0]->{release})) { + print "Kitcomponent $kc->{basename} does not have a release specified and there is no Kit release value set to use as a default. \n"; + return 1; + } else { + $kc->{release} = $::bldkit_config->{kit}{entries}[0]->{release}; + } + } + + } + + # Make sure each kitcomponent has unique basename/repoid + # If same basename, make sure version/release are same, too + my $kc_count = scalar @{ $::bldkit_config->{kitcomponent}{entries} }; + if ($kc_count > 1) { + foreach my $kci (0 .. $kc_count - 2) { + foreach my $kci2 ($kci + 1 .. $kc_count - 1) { + if ($::bldkit_config->{kitcomponent}{entries}[$kci]->{basename} + eq $::bldkit_config->{kitcomponent}{entries}[$kci2]->{basename}) { + if ($::bldkit_config->{kitcomponent}{entries}[$kci]->{kitrepoid} + eq $::bldkit_config->{kitcomponent}{entries}[$kci2]->{kitrepoid}) { + + print "Two or more kitcomponents are defined with the same basename \"$::bldkit_config->{kitcomponent}{entries}[$kci]->{basename}\" and the same repoid \"$::bldkit_config->{kitcomponent}{entries}[$kci]->{kitrepoid}\". \n"; + return 1; + } + if (($::bldkit_config->{kitcomponent}{entries}[$kci]->{version} + ne $::bldkit_config->{kitcomponent}{entries}[$kci2]->{version}) || + ($::bldkit_config->{kitcomponent}{entries}[$kci]->{release} + ne $::bldkit_config->{kitcomponent}{entries}[$kci2]->{release}) + ) { + print "Two or more kitcomponents are defined with the same basename \"$::bldkit_config->{kitcomponent}{entries}[$kci]->{basename}\" but with different version or release. \n"; + return 1; + } + } + } + } + } + + # Kitrepo checks + foreach my $kr (@{ $::bldkit_config->{kitrepo}{entries} }) { + my $reponame = $short_kitname; + if ((defined($::bldkit_config->{kit}{entries}[0]->{osbasename})) && + ($::bldkit_config->{kit}{entries}[0]->{osbasename} ne + $kr->{osbasename})) { + print "Warning: Kit osbasename is set to \"$::bldkit_config->{kit}{entries}[0]->{osbasename}\", but this does not match kitrepo $kr->{kitrepoid} osbasename \"$kr->{osbasename}\". Processing will continue, but verify that you do not have an error in your buildkit configuration file. \n"; + } + $reponame .= '-' . $kr->{osbasename}; + if ((defined($::bldkit_config->{kit}{entries}[0]->{osmajorversion})) && + ($::bldkit_config->{kit}{entries}[0]->{osmajorversion} ne + $kr->{osmajorversion})) { + print "Warning: Kit osmajorversion is set to \"$::bldkit_config->{kit}{entries}[0]->{osmajorversion}\", but this does not match kitrepo $kr->{kitrepoid} osmajorversion \"$kr->{osmajorversion}\". Processing will continue, but verify that you do not have an error in your buildkit configuration file. \n"; + } + $reponame .= '-' . $kr->{osmajorversion}; + if (defined($kr->{osminorversion})) { + my $krminor = $kr->{osminorversion}; + unless ($krminor =~ /^\d/) { + $krminor = split /<=|>=|==|<|>|=/, $kr->{osminorversion}; + } + if ((defined($::bldkit_config->{kit}{entries}[0]->{osminorversion})) && + ($::bldkit_config->{kit}{entries}[0]->{osminorversion} ne + $kr->{osminorversion})) { + print "Warning: Kit osminorversion is set to \"$::bldkit_config->{kit}{entries}[0]->{osminorversion}\", but this does not match kitrepo $kr->{kitrepoid} osminorversion \"$kr->{osminorversion}\". Processing will continue, but verify that you do not have an error in your buildkit configuration file. \n"; + } + $reponame .= '.' . $krminor; + $::bldkit_config->{kit}{entries}[0]->{osminorversion} = $krminor; + } + if ((defined($::bldkit_config->{kit}{entries}[0]->{osarch})) && + ($::bldkit_config->{kit}{entries}[0]->{osarch} ne + $kr->{osarch})) { + print "Warning: Kit osarch is set to \"$::bldkit_config->{kit}{entries}[0]->{osarch}\", but this does not match kitrepo $kr->{kitrepoid} osarch \"$kr->{osarch}\". Processing will continue, but verify that you do not have an error in your buildkit configuration file. \n"; + } + $reponame .= '-' . $kr->{osarch}; + $kr->{kitreponame} = $reponame; + } + + # Kitcomponent checks + foreach my $kc (@{ $::bldkit_config->{kitcomponent}{entries} }) { + + # Make sure all kitcomponent kitrepoids are defined + my $found = 0; + my %repo; + if ($debianflag) { + if ($kc->{basename} =~ /_/) { + print "Kit Component basename can not contain underscore.\n"; + return 1; + } + } + foreach my $kr (@{ $::bldkit_config->{kitrepo}{entries} }) { + if ($kc->{kitrepoid} eq $kr->{kitrepoid}) { + $found = 1; + %repo = %{$kr}; + $kc->{kitreponame} = $kr->{kitreponame}; + push(@{ $kr->{packages} }, &comppkgname($kc, $kr)); + last; + } + } + if (!$found) { + print "Kit Repository \"$kc->{kitrepoid}\" required by the Kit Component \"$kc->{basename}\" not defined in the Kit Build file.\n"; + return 1; + } + + # Create full kitcomponent name + my $compname = $kc->{basename}; + $compname .= '-' . $kc->{version}; + $compname .= '-' . $kc->{release}; + $compname .= '-' . $repo{osbasename}; + $compname .= '-' . $repo{osmajorversion}; + if (defined($repo{osminorversion})) { + my $minorversion = $repo{osminorversion}; + unless ($minorversion =~ /^\d/) { + $minorversion = split /<=|>=|==|<|>|=/, $repo{osminorversion}; + } + $compname .= '.' . $minorversion; + } + $compname .= '-' . $repo{osarch}; + $kc->{kitcompname} = $compname; + + # Make sure all kitcomponent kitpkgdeps are defined + if (defined($kc->{kitpkgdeps})) { + foreach my $d (split(/,/, $kc->{kitpkgdeps})) { + $d =~ s/\s+//g; + $d =~ s/^([\w\.\-]+)[<>=]*.*$/$1/; + my $found = 0; + foreach my $kp (@{ $::bldkit_config->{kitpackage}{entries} }) { + if ($kp->{filename} =~ /^$d[\.\-]?/) { + foreach my $kprid (split(/,/, $kp->{kitrepoid})) { + $kprid =~ s/\s+//g; + if ($kc->{kitrepoid} eq $kprid) { + $found = 1; + last; + } + } + } + if ($found) { last; } + } + if (!$found) { + print "Kit Package \"$d\" required by the Kit Component \"$kc->{basename}\" was not found in the Kit Component\'s repository \"$kc->{kitrepoid}\".\n"; + return 1; + } + } + } + + # Make sure all kitcomponent driverpacks are defined + if (defined($kc->{driverpacks})) { + my @drvs = split(/,/, $kc->{driverpacks}); + foreach my $d (@drvs) { + $d =~ s/\s+//g; + my $found = 0; + foreach my $kp (@{ $::bldkit_config->{kitpackage}{entries} }) { + if ($kp->{filename} eq $d) { + foreach my $kprid (split(/,/, $kp->{kitrepoid})) { + $kprid =~ s/\s+//g; + if ($kc->{kitrepoid} eq $kprid) { + $found = 1; + last; + } + } + } + if ($found) { last; } + } + if (!$found) { + print "Driver package \"$d\" required by the Kit Component \"$kc->{basename}\" was not found in the Kit Component\'s repository \"$kc->{kitrepoid}\".\n"; + return 1; + } + } + } + + # Make sure files exist + if (defined($kc->{exlist})) { + my $ck_file = $::workdir . "/other_files/" . $kc->{exlist}; + if (!-r $ck_file) { + print "Exclude List file $ck_file defined in Kit Componenet \"$kc->{basename}\" does not exist or is not readable\n"; + return 1; + } + } + if (defined($kc->{preinstall})) { + my $ck_file = $::workdir . "/scripts/" . $kc->{preinstall}; + if (!-r $ck_file) { + print "Pre-Install script $ck_file defined in Kit Componenet \"$kc->{basename}\" does not exist or is not readable\n"; + return 1; + } + } + if (defined($kc->{postinstall})) { + my $ck_file = $::workdir . "/scripts/" . $kc->{postinstall}; + if (!-r $ck_file) { + print "Post-Install script $ck_file defined in Kit Componenet \"$kc->{basename}\" does not exist or is not readable\n"; + return 1; + } + } + if (defined($kc->{preuninstall})) { + my $ck_file = $::workdir . "/scripts/" . $kc->{preuninstall}; + if (!-r $ck_file) { + print "Pre-Uninstall script $ck_file defined in Kit Componenet \"$kc->{basename}\" does not exist or is not readable\n"; + return 1; + } + } + if (defined($kc->{postuninstall})) { + my $ck_file = $::workdir . "/scripts/" . $kc->{postuninstall}; + if (!-r $ck_file) { + print "Post-Uninstall script $ck_file defined in Kit Componenet \"$kc->{basename}\" does not exist or is not readable\n"; + return 1; + } + } + if (defined($kc->{preupgrade})) { + my $ck_file = $::workdir . "/scripts/" . $kc->{preupgrade}; + if (!-r $ck_file) { + print "Pre-Upgrade script $ck_file defined in Kit Componenet \"$kc->{basename}\" does not exist or is not readable\n"; + return 1; + } + } + if (defined($kc->{postupgrade})) { + my $ck_file = $::workdir . "/scripts/" . $kc->{postupgrade}; + if (!-r $ck_file) { + print "Post-Upgrade script $ck_file defined in Kit Componenet \"$kc->{basename}\" does not exist or is not readable\n"; + return 1; + } + } + if (defined($kc->{genimage_postinstall})) { + foreach my $script (split(/\,/, $kc->{genimage_postinstall})) { + $script =~ s/\s+//g; + my $ck_file = $::workdir . "/scripts/" . $script; + if (!-r $ck_file) { + print "genimage_postinstall script $ck_file defined in Kit Componenet \"$kc->{basename}\" does not exist or is not readable\n"; + return 1; + } + } + } + if (defined($kc->{postbootscripts})) { + foreach my $script (split(/\,/, $kc->{postbootscripts})) { + $script =~ s/\s+//g; + my $ck_file = $::workdir . "/scripts/" . $script; + if (!-r $ck_file) { + print "Postboot script $ck_file defined in Kit Componenet \"$kc->{basename}\" does not exist or is not readable\n"; + return 1; + } + } + } + if (defined($kc->{non_native_pkgs})) { + if ($kc->{non_native_pkgs} =~ /EXTERNALPKGS/) { + $::NON_NATIVE_PKGS->{ $kc->{kitcompname} } = 1; + $::HAVE_NON_NATIVE_PKGS = 1; + } + } + } + + # Kitpackage checks + foreach my $kp (@{ $::bldkit_config->{kitpackage}{entries} }) { + + # determine if valid build method + if ((defined($kp->{isexternalpkg})) || + (defined($kp->{rpm_prebuiltdir}))) { + if ((defined($kp->{rpm_srpm})) || + (defined($kp->{rpm_srctarball})) || + (defined($kp->{rpm_spec})) || + (defined($kp->{rpm_srcdir}))) { + print "Cannot determine build method for Kit Package $kp->{filename}. Conflicting attributes were specified.\n"; + return 1; + } + if (!(defined($kp->{isexternalpkg}))) { $kp->{isexternalpkg} = 'no'; } + my $orig_isext = $kp->{isexternalpkg}; + $kp->{isexternalpkg} =~ s/\s+//g; + $kp->{isexternalpkg} =~ tr/A-Z/a-z/; # convert to lowercase + if ($kp->{isexternalpkg} eq '0') { $kp->{isexternalpkg} = 'no'; } + if ($kp->{isexternalpkg} eq '1') { $kp->{isexternalpkg} = 'yes'; } + if (($kp->{isexternalpkg} ne 'yes') && + ($kp->{isexternalpkg} ne 'no')) { + print "Error in definition for Kit Package $kp->{filename}. Invalid attribute value \'isexternalpkg=$orig_isext\'. Valid values are \'no\'|\'0\' or \'yes\'|\'1\'.\n"; + return 1; + } + if (($kp->{isexternalpkg} eq 'yes')) { + $::HAVE_EXTERNAL_PKG = 1; + } + if (($kp->{isexternalpkg} eq 'yes') && + (defined($kp->{rpm_prebuiltdir}))) { + print "Error in definition for Kit Package $kp->{filename}. Do not specify \'isexternalpkg=$orig_isext\' with 'rpm_prebuiltdir'.\n"; + return 1; + } + } elsif (defined($kp->{rpm_srpm})) { + if ((defined($kp->{rpm_prebuiltdir})) || + (defined($kp->{rpm_srctarball})) || + (defined($kp->{rpm_spec})) || + (defined($kp->{rpm_srcdir}))) { + print "Cannot determine build method for Kit Package $kp->{filename}. Conflicting attributes were specified.\n"; + return 1; + } + } elsif (defined($kp->{rpm_srctarball}) && + defined($kp->{rpm_spec})) { + if ((defined($kp->{rpm_prebuiltdir})) || + (defined($kp->{rpm_srpm})) || + (defined($kp->{rpm_srcdir}))) { + print "Cannot determine build method for Kit Package $kp->{filename}. Conflicting attributes were specified.\n"; + return 1; + } + } elsif (defined($kp->{rpm_srcdir}) && + defined($kp->{rpm_spec})) { + if ((defined($kp->{rpm_prebuiltdir})) || + (defined($kp->{rpm_srpm})) || + (defined($kp->{rpm_srctarball}))) { + print "Cannot determine build method for Kit Package $kp->{filename}. Conflicting attributes were specified.\n"; + return 1; + } + } else { + print "Cannot determine build method for Kit Package $kp->{filename}. Verify that your Kit Build File is correct. \n"; + return 1; + } + + # Make sure all kitpackage kitrepoids are defined + foreach my $kprid (split(/,/, $kp->{kitrepoid})) { + my $found = 0; + $kprid =~ s/\s+//g; + foreach my $kr (@{ $::bldkit_config->{kitrepo}{entries} }) { + if ($kprid eq $kr->{kitrepoid}) { + $found = 1; + $kp->{kitreponame} .= "," . $kr->{kitreponame}; + if (!($kp->{isexternalpkg} eq 'yes')) { + push(@{ $kr->{packages} }, $kp->{filename}); + } + last; + } + } + if (!$found) { + print "Kit Repository \"$kprid\" required by the Kit Package \"$kp->{filename}\" is not defined in the Kit Build file.\n"; + return 1; + } + } + $kp->{kitreponame} =~ s/^,//; + if (!$::NEW_PARTIAL_KIT) { + + # Make sure files exist + if (defined($kp->{rpm_spec})) { + my $ck_file = $::workdir . "/source_packages/" . $kp->{rpm_spec}; + if (!-r $ck_file) { + print "RPM spec file $ck_file defined in Kit Package \"$kp->{filename}\" does not exist or is not readable\n"; + return 1; + } + } + if (defined($kp->{rpm_srcdir})) { + my $ck_dir = $::workdir . "/source_packages/" . $kp->{rpm_srcdir}; + if (!-d $ck_dir) { + print "RPM source directory $ck_dir defined in Kit Package \"$kp->{filename}\" does not exist or is not readable\n"; + return 1; + } + } + if (defined($kp->{rpm_srctarball})) { + my $ck_file = $::workdir . "/source_packages/" . $kp->{rpm_srctarball}; + if (!-r $ck_file) { + print "RPM source tarfile $ck_file defined in Kit Package \"$kp->{filename}\" does not exist or is not readable\n"; + return 1; + } + } + if (defined($kp->{rpm_srpm})) { + my $ck_file = $::workdir . "/source_packages/" . $kp->{rpm_srpm}; + if (!-r $ck_file) { + print "Source RPM $ck_file defined in Kit Package \"$kp->{filename}\" does not exist or is not readable\n"; + return 1; + } + } + if (defined($kp->{rpm_prebuiltdir})) { + my $ck_dir = $::workdir . "/source_packages/" . $kp->{rpm_prebuiltdir}; + if (!-d $ck_dir) { + print "Pre-built RPM directory $ck_dir defined in Kit Package \"$kp->{filename}\" does not exist or is not readable\n"; + return 1; + } + my $ck_file = $ck_dir . "/" . $kp->{filename}; + if (system("ls $ck_file > /dev/null")) { + + # if (! -r $ck_file ) { + print "Pre-built rpm $ck_file defined in Kit Package \"$kp->{filename}\" does not exist or is not readable\n"; + return 1; + } + } + } + } + + #use Data::Dumper; + #print Dumper($::bldkit_config->{kitrepo}); + return 0; +} + +#----------------------------------------------------------------------------- + +=head3 comppkgname + + build a metapkg rpm filename for this kitcomponent + input: kitcomponent hash + kitrepo hash that this kitcomponent belongs to + +=cut + +#----------------------------------------------------------------------------- +sub comppkgname +{ + my $comp = shift; + + my $pkgname = $comp->{basename}; + if ($debianflag) { + $pkgname .= '_' . $comp->{version}; + $pkgname .= '-' . $comp->{release}; + $pkgname .= '_all.deb'; + } + else { + $pkgname .= '-' . $comp->{version}; + $pkgname .= '-' . $comp->{release}; + $pkgname .= '.noarch.rpm'; + } + return $pkgname; +} + +#----------------------------------------------------------------------------- + +=head3 validate_repo + + validate whether a kit repo has been built + input: repo hash + returns rc: + 0 - repo status is DONE + 1 - repo status is NOT DONE + verbose mode displays message for first rpm not built + +=cut + +#----------------------------------------------------------------------------- +sub validate_repo +{ + my $repo = shift; + + my $repodir = $::base_repodir . "/" . $repo->{kitreponame}; + if (!-d $repodir) { + if ($::VERBOSE) { + print "\n$repodir does not exist. No rpms have been built for this kitrepo. \n"; + } + return 1; + } + + # Make sure each repo pkg exists + foreach my $pkg (@{ $repo->{packages} }) { + + # skip check for kit component meta rpm if it includes + # external non-native pkgs + my $skip_check = 0; + foreach my $kc (@{ $::bldkit_config->{kitcomponent}{entries} }) { + if ($repo->{kitrepoid} eq $kc->{kitrepoid}) { + my $kitpkgname = comppkgname($kc); + if (($kitpkgname eq $pkg) && + ($::NON_NATIVE_PKGS->{ $kc->{kitcompname} })) { + $skip_check = 1; + last; + } + } + } + if (!$skip_check) { + my $pkg_filename = $repodir . '/' . $pkg; + if (system("ls $pkg_filename > /dev/null")) { + if ($::VERBOSE) { + print "\nFile $pkg in directory $repodir does not exist or is not readable. \n"; + } + return 1; + } + } + } + return 0; +} + +#----------------------------------------------------------------------------- + +=head3 validate_os + + validate whether a kit repo matches the current OS + input: repo hash + returns rc: + 0 - match + 1 - no match + verbose mode displays message for mismatch details + +=cut + +#----------------------------------------------------------------------------- +sub validate_os +{ + my $repo = shift; + + my $osinfo = xCAT::BuildKitUtils->osver(); + my ($osbasename, $osmore) = split(/\,/, $osinfo); + my ($osmajorversion, $osminorversion) = split(/\./, $osmore); + my $osarch = `uname -p`; + chomp($osarch); + + if ($debianflag == 1) { + if ($osarch eq "ppc64le") { + $osarch = "ppc64el"; + } + } + $osinfo =~ s/\,//; + my $repo_osinfo = "$repo->{osbasename}$repo->{osmajorversion}"; + my $minorversion; + if (defined($repo->{osminorversion})) { + $minorversion = $repo->{osminorversion}; + unless ($minorversion =~ /^\d/) { + $minorversion = split /<=|>=|==|<|>|=/, $repo->{osminorversion}; + } + $repo_osinfo .= ".$minorversion"; + } + $repo_osinfo .= "-$repo->{osarch} "; + my $mismatch_msg = "The local host is running $osinfo-$osarch. This does not match the Kit Repository \"$repo->{kitrepoid}\" data: $repo_osinfo"; + if (defined($repo->{compat_osbasenames})) { + $mismatch_msg .= " or the compatible OS distros: $repo->{compat_osbasenames} "; + } + + + my $compat_match = 0; + if ($repo->{osbasename} ne $osbasename) { + if (defined($repo->{compat_osbasenames})) { + foreach my $cos (split(/,/, $repo->{compat_osbasenames})) { + if ($cos eq $osbasename) { + $compat_match = 1; + last; + } + } + } + if (!$compat_match) { + print "$mismatch_msg \n"; + if ($::VERBOSE) { + print "\n Local OS basename $osbasename does not match repository.\n"; + } + return 1; + } + } + if (($repo->{osmajorversion} ne $osmajorversion) && + (!$compat_match)) { + print "$mismatch_msg \n"; + if ($::VERBOSE) { + print "\n Local OS major version $osmajorversion does not match repository.\n"; + } + return 1; + } + if (defined($repo->{osminorversion})) { + if (($minorversion ne $osminorversion) && + (!$compat_match)) { + print "$mismatch_msg \n"; + if ($::VERBOSE) { + print "\n Local OS minor version $osminorversion does not match repository.\n"; + } + return 1; + } + } + if ($repo->{osarch} ne $osarch) { + print "$mismatch_msg \n"; + if ($::VERBOSE) { + print "\n Local OS arch $osarch does not match repository.\n"; + } + return 1; + } + return 0; +} + +#----------------------------------------------------------------------------- + +=head3 build_kitcomp + + build a metapkg rpm for this kitcomponent + input: kitcomponent hash + +=cut + +#----------------------------------------------------------------------------- +sub build_kitcomp +{ + my $comp = shift; + my %repo; + my $rpmbuild_dir = $::workdir . "/rpmbuild"; + my $tmpdir = $::workdir . "/tmp/$comp->{kitcompname}"; + my $kcmetaname = comppkgname($comp); + + # If this kitcomponent has external non-native pkgs, + # skip the meta rpm build + if (defined($::NON_NATIVE_PKGS) && + defined($::NON_NATIVE_PKGS->{ $comp->{kitcompname} }) && + $::NON_NATIVE_PKGS->{ $comp->{kitcompname} }) { + if ($::VERBOSE) { + print "Kit component $comp->{kitcompname} has external non-native packages. Skipping rpm build for $kcmetaname. \n"; + } + return 0; + } + + # find the kitrepo hash for this component + foreach my $kr (@{ $::bldkit_config->{kitrepo}{entries} }) { + if ($comp->{kitrepoid} eq $kr->{kitrepoid}) { + %repo = %{$kr}; + last; + } + } + my $repodir = $::base_repodir . "/" . $repo{kitreponame}; + + # Fix the kitpkgdeps value for this kitcomponent + # For any kitpkgdep that has an rpm file in the repo, + # specifically reference it's version-release + if (&update_kitcomp_kitpkgdeps($comp, $repodir)) { return 1; } + + $::VALID_PRER_COMPONENT = 0; + + if (!$::PREREQUISITE) { + if ($comp->{ospkgdeps} || $comp->{preinstall} || $comp->{preupgrade}) { + if (&gen_kitcomp_spec($comp, \%repo, 'PREREQUISITE')) { return 1; } + + # run the rpmbuild command + my $curdir = $::workdir; + my $cmd = "rm -Rf $curdir/rpmbuild"; + system($cmd); + my $avoiderr = $rpmbuild_dir . "/BUILDROOT/prep_" . $comp->{basename}; + $avoiderr .= "-$comp->{version}-$comp->{release}.$repo{osarch}"; + mkpath($avoiderr); + $avoiderr = $rpmbuild_dir . "/BUILD/"; + mkpath($avoiderr); + $avoiderr = $rpmbuild_dir . "/SRPMS/"; + mkpath($avoiderr); + $avoiderr = $rpmbuild_dir . "/RPMS/noarch/"; + mkpath($avoiderr); + + # Read the kit component prerequisite rpm name + + my $specfile = $::workdir . "/tmp/$comp->{kitcompname}-prep.spec"; + my $rpmbuild_cmd = "rpmbuild --define \"_topdir $rpmbuild_dir\" -ba $specfile"; + + # don't want debug info - 3845 + # if (!$::VERBOSE) { + $rpmbuild_cmd .= ' --quiet '; + + # } + if (system($rpmbuild_cmd)) { + print "Error running rpmbuild command for kit component $comp->{kitcompname} meta package\n"; + return 1; + } + my @built_rpms = `find $rpmbuild_dir/RPMS -name "*.rpm"`; + foreach my $rpm (@built_rpms) { + chomp($rpm); + if (system("cp -fp $rpm $repodir")) { + print "Error copying rpm $rpm to build repo directory $repodir \n"; + return 1; + } + } + + $::VALID_PRER_COMPONENT = 1; + + } + + if (&gen_kitcomp_spec($comp, \%repo, 'METARPM')) { return 1; } + } else { + + # Create spec file for this kit component + if (&gen_kitcomp_spec($comp, \%repo, 'ALL')) { return 1; } + } + + # run the rpmbuild command + my $curdir = $::workdir; + my $cmd = "rm -Rf $curdir/rpmbuild"; + system($cmd); + my $avoiderr = $rpmbuild_dir . "/BUILDROOT/" . $comp->{basename}; + $avoiderr .= "-$comp->{version}-$comp->{release}.$repo{osarch}"; + mkpath($avoiderr); + $avoiderr = $rpmbuild_dir . "/BUILD/"; + mkpath($avoiderr); + $avoiderr = $rpmbuild_dir . "/SRPMS/"; + mkpath($avoiderr); + $avoiderr = $rpmbuild_dir . "/RPMS/noarch/"; + mkpath($avoiderr); + + # Read the kit component meta rpm name + + my $specfile = $::workdir . "/tmp/$comp->{kitcompname}.spec"; + my $rpmbuild_cmd = "rpmbuild --define \"_topdir $rpmbuild_dir\" -ba $specfile"; + + # Copy in any non-native packages + if (defined($comp->{non_native_pkgs})) { + mkpath($tmpdir); + mkpath("$rpmbuild_dir/SOURCES"); + my $sourcedir = $::workdir . "/source_packages"; + + foreach my $pkgfile (split(/,/, $comp->{non_native_pkgs})) { + my $pkg_file; + my ($key, $value) = split /:/, $pkgfile; + if ("$key" =~ /EXTERNALPKGS/) { + $pkg_file = $value; + } else { + $pkg_file = $key; + } + + $cmd = "cp -p $sourcedir/$pkg_file $tmpdir"; + if (system($cmd)) { + print "Error copying non-native package file $sourcedir/$pkg_file to $tmpdir\n"; + return 1; + } + } + $cmd = "cd $tmpdir/..;mv $comp->{kitcompname} $comp->{basename}; tar -czf $rpmbuild_dir/SOURCES/$comp->{basename}.tar.gz $comp->{basename};mv $comp->{basename} $comp->{kitcompname}"; + if (system($cmd)) { + print "Error creating tarfile $rpmbuild_dir/SOURCES/$comp->{kitreponame}-$comp->{kitcompname}.tar from $sourcedir/*"; + return 1; + } + } + + # - don't want debug info - 3845 + # if (!$::VERBOSE) { + $rpmbuild_cmd .= ' --quiet '; + + # } + + if (system($rpmbuild_cmd)) { + print "Error running rpmbuild command for kit component $comp->{kitcompname} meta package\n"; + return 1; + } + my @built_rpms = `find $rpmbuild_dir/RPMS -name "*.rpm"`; + foreach my $rpm (@built_rpms) { + chomp($rpm); + if (system("cp -fp $rpm $repodir")) { + print "Error copying rpm $rpm to build repo directory $repodir \n"; + return 1; + } + } + return 0; +} + +#----------------------------------------------------------------------------- + +=head3 update_kitcomp_kitpkgdeps + + Update the kitcomponent kitpkgdeps string + For any kitpkgdep that does not explicitly specify a version-release + comparison string and for which an rpm exists in the repo, + query the rpm for its version-release info and set an explicit + comparison string. + Reason we need to do all this: We need to force yum/zypper to update + the product rpms. A simple package name in the kitcomponent meta rpm + REQUIRES entry will not cause the product to get updated if an older + version is already installed. Need to explicitly require this version + and release of the product package. + input: kitcomponent hash + kitrepo directory + +=cut + +#----------------------------------------------------------------------------- +sub update_kitcomp_kitpkgdeps +{ + my $comp = shift; + my $repodir = shift; + + if (defined($comp->{kitpkgdeps})) { + + # we have some rpms listed in buildkit.conf file + my $new_kitpkgdeps = ''; + foreach my $d (split(/,/, $comp->{kitpkgdeps})) { + $d =~ s/\s+//g; + my $d_short = $d; + + # strip off everything after ">=" + $d_short =~ s/^([\w\.\-]+)[<>=]*.*$/$1/; + + # if they are the same then there was no v/r info provided + if ($d_short eq $d) { + + # no version-release comparisons specified for this kitpkgdep + # do we have this rpm file? + # get a list of any matches + my $lscmd = "cd $repodir; /bin/ls $d-\[0-9\]\*.rpm 2>/dev/null"; + my @rpmlist = `$lscmd`; + + if (scalar(@rpmlist) == 0) { + next; + } + + # get the newest version there is + my $newestrpm = xCAT::BuildKitUtils->get_latest_version($repodir, \@rpmlist); + + if (!$newestrpm) { + print "Error: Could not determine the latest version of rpm $d contained in $repodir. \n"; + next; + } + + # get the Version and release values for this rpm + my $cmd = "rpm -q --qf \"%{NAME} >= %{VERSION}-%{RELEASE}\" -p $repodir/$newestrpm 2>/dev/null"; + if ($::VERBOSE) { + print "running rpm query to get version-release info: \n $cmd \n"; + } + + my $new_d = `$cmd`; + if (!$new_d) { + print "Error: Could not determine the latest version of rpm $d. \n"; + next; + } + + chomp($new_d); + if ($::VERBOSE) { + print "output: \n \'$new_d\' \n"; + } + if ($new_d ne '') { + $new_kitpkgdeps .= "$new_d,"; + } else { + $new_kitpkgdeps .= "$d,"; + } + } else { + $new_kitpkgdeps .= "$d,"; + } + } + + $new_kitpkgdeps =~ s/(\,)*$//; + $comp->{kitpkgdeps} = $new_kitpkgdeps; + } + + return 0; +} + +#----------------------------------------------------------------------------- + +=head3 gen_kitcomp_spec + + generate the rpm spec file for the kitcomponent metapkg rpm + input: kitcomponent hash + kitrepo hash + +=cut + +#----------------------------------------------------------------------------- +sub gen_kitcomp_spec +{ + my $comp = shift; + my $repo = shift; + my $level = shift; + my $scriptdir = $::workdir . "/scripts/"; + my $tmpdir = $::workdir . "/tmp/"; + + # read in the template spec file + my $spec_template = $::XCATSHARE . "/kits/kitcomponent.spec.template"; + my $SF; + unless (open($SF, "<", $spec_template)) { + print "Error attempting to open the xCAT Kit Component template file $spec_template. \n"; + return 1; + } + if ($::VERBOSE) { + print "Reading the xCAT Kit Component template file $spec_template. \n"; + } + my @lines = <$SF>; + close $SF; + + my $kitname = $::bldkit_config->{kit}{entries}[0]->{basename}; + my $kitcompname = $comp->{kitcompname}; + + my ($prescript, $postscript, $preupscript, $postupscript, $preunscript, $postunscript, $nonnativepkgs, $sourcetar, $setup, $files) = ' '; + if ($level eq 'PREREQUISITE' || $level eq 'ALL') { + if (defined($comp->{preinstall})) { + $prescript = &load_script("$scriptdir$comp->{preinstall}"); + $prescript = "if [ \"\$1\" = \"1\" ] ; then\n" . $prescript . "\nfi"; } + if (defined($comp->{preupgrade})) { + $preupscript = &load_script("$scriptdir$comp->{preupgrade}"); + $preupscript = "if [ \"\$1\" = \"2\" ] ; then\n" . $preupscript . "\nfi"; } + } + if ($level eq 'METARPM' || $level eq 'ALL') { + if (defined($comp->{preuninstall})) { + $preunscript = &load_script("$scriptdir$comp->{preuninstall}"); } + if (defined($comp->{postinstall})) { + $postscript = &load_script("$scriptdir$comp->{postinstall}"); + $postscript = "if [ \"\$1\" = \"1\" ] ; then\n" . $postscript . "\nfi"; } + if (defined($comp->{postupgrade})) { + $postupscript = &load_script("$scriptdir$comp->{postupgrade}"); + $postupscript = "if [ \"\$1\" = \"2\" ] ; then\n" . $postupscript . "\nfi"; } + if (defined($comp->{postuninstall})) { + $postunscript = &load_script("$scriptdir$comp->{postuninstall}"); } + if (defined($comp->{non_native_pkgs})) { + $nonnativepkgs = "\n"; + $nonnativepkgs .= "mkdir -p \$RPM_BUILD_ROOT/opt/xcat/kits/$kitname/$kitcompname \n"; + $nonnativepkgs .= "cp -a * \$RPM_BUILD_ROOT/opt/xcat/kits/$kitname/$kitcompname \n"; + $sourcetar = "Source: $comp->{basename}.tar.gz"; + $setup = "\%setup -q -n $comp->{basename}"; + $files = "/opt/xcat/kits"; + } + } + + # remove lines that correspond to optional tags that have no values + # in this instance. Adding lines to the spec file that have + # no values will cause a build error. + my @newlines; + foreach my $l (@lines) { + chomp; + + # don't add vendor,packager,url to spec file unless we have a value + if ($l =~ /INSERT_vendor_HERE/) { + if (!$::bldkit_config->{kit}{entries}[0]->{vendor}) { + next; + } + } + if ($l =~ /INSERT_packager_HERE/) { + if (!$::bldkit_config->{kit}{entries}[0]->{packager}) { + next; + } + } + if ($l =~ /INSERT_url_HERE/) { + if (!$::bldkit_config->{kit}{entries}[0]->{url}) { + next; + } + } + push @newlines, $l; + } + @lines = @newlines; + + if ($level eq 'ALL') { + for (@lines) { + chomp; + s/<<>>/$kitname/; + s/<<>>/$comp->{basename}/; + s/<<>>/$comp->{version}/; + s/<<>>/$comp->{release}/; +s/<<>>/$::bldkit_config->{kit}{entries}[0]->{kitlicense}/; +s/<<>>/$::bldkit_config->{kit}{entries}[0]->{vendor}/; +s/<<>>/$::bldkit_config->{kit}{entries}[0]->{packager}/; + s/<<>>/$::bldkit_config->{kit}{entries}[0]->{url}/; + s/<<>>/$comp->{ospkgdeps}/; + s/<<>>/$comp->{kitpkgdeps}/; + s/<<>>/$comp->{kitcompdeps}/; + s/<<>>/$comp->{description}/; + s/<<>>/$nonnativepkgs/; + s/<<>>/$sourcetar/; + s/<<>>/$setup/; + s/<<>>/$files/; + s/<<>>/$prescript/; + s/<<>>/$postscript/; + s/<<>>/$preupscript/; + s/<<>>/$postupscript/; + s/<<>>/$preunscript/; +s/<<>>/$postunscript/; + } + } elsif ($level eq 'PREREQUISITE') { + for (@lines) { + chomp; + s/<<>>/$kitname/; + s/<<>>/prep_$comp->{basename}/; + s/<<>>/$comp->{version}/; + s/<<>>/$comp->{release}/; +s/<<>>/$::bldkit_config->{kit}{entries}[0]->{kitlicense}/; +s/<<>>/$::bldkit_config->{kit}{entries}[0]->{vendor}/; +s/<<>>/$::bldkit_config->{kit}{entries}[0]->{packager}/; + s/<<>>/$::bldkit_config->{kit}{entries}[0]->{url}/; + s/<<>>/$comp->{ospkgdeps}/; + s/<<>>//; + s/<<>>//; + s/<<>>/$comp->{description}/; + s/<<>>//; + s/<<>>//; + s/<<>>//; + s/<<>>//; + s/<<>>/$prescript/; + s/<<>>//; + s/<<>>/$preupscript/; + s/<<>>//; + s/<<>>/$preunscript/; + s/<<>>//; + } + + } elsif ($level eq 'METARPM') { + for (@lines) { + chomp; + s/<<>>/$kitname/; + s/<<>>/$comp->{basename}/; + s/<<>>/$comp->{version}/; + s/<<>>/$comp->{release}/; +s/<<>>/$::bldkit_config->{kit}{entries}[0]->{kitlicense}/; +s/<<>>/$::bldkit_config->{kit}{entries}[0]->{vendor}/; +s/<<>>/$::bldkit_config->{kit}{entries}[0]->{packager}/; + s/<<>>/$::bldkit_config->{kit}{entries}[0]->{url}/; + s/<<>>//; + s/<<>>/$comp->{kitpkgdeps}/; + + #Update kitcompdeps for prep_ + if ($::VALID_PRER_COMPONENT) { +s/<<>>/$comp->{kitcompdeps},prep_$comp->{basename}/; + } else { +s/<<>>/$comp->{kitcompdeps}/; + } + s/<<>>/$comp->{description}/; + s/<<>>/$nonnativepkgs/; + s/<<>>/$sourcetar/; + s/<<>>/$setup/; + s/<<>>/$files/; + s/<<>>//; + s/<<>>/$postscript/; + s/<<>>//; + s/<<>>/$postupscript/; + s/<<>>/$preunscript/; +s/<<>>/$postunscript/; + } + } + + # Write the generated spec file + mkpath($tmpdir); + + my $fn; + my $NSF; + if ($level eq 'PREREQUISITE') { + $fn = $comp->{kitcompname} . "-prep.spec" + } else { + $fn = $comp->{kitcompname} . ".spec" + } + unless (open($NSF, ">$tmpdir$fn")) { + return 1; + } + if ($::VERBOSE) { + print "Created kitcomponent spec file \'$tmpdir$fn\'\n"; + + } + foreach my $line (@lines) { + print $NSF $line, "\n"; + } + + close($NSF); + return 0; +} + +#----------------------------------------------------------------------------- + +=head3 build_kitcomp_debian + + + +=cut + +#----------------------------------------------------------------------------- +sub build_kitcomp_debian { + my $comp = shift; + my %repo; + my $debbuilddir = $::workdir . "/debbuild/" . $comp->{kitcompname}; + my $kcmetaname = comppkgname($comp); + + #If this kitcomponent has external non-native pkgs, + #skip the meta package build + if (defined($::NON_NATIVE_PKGS) && + defined($::NON_NATIVE_PKGS->{ $comp->{kitcompname} }) && + $::NON_NATIVE_PKGS->{ $comp->{kitcompname} }) { + if ($::VERBOSE) { + print "Kit component $comp->{kitcompname} has external non-native packages. Skipping rpm build for $kcmetaname. \n"; + } + return 0; + } + + # find the kitrepo hash for this component + foreach my $kr (@{ $::bldkit_config->{kitrepo}{entries} }) { + if ($comp->{kitrepoid} eq $kr->{kitrepoid}) { + %repo = %{$kr}; + last; + } + } + + + #run the dpkg-buildpackage command + my $curdir = $::workdir; + my $cmd = "rm -Rf $debbuilddir"; + system($cmd); + mkpath($debbuilddir); + + $::VALID_PREP_COMPONENT = 0; + + if (!$::PREREQUISITE) { + if ($comp->{ospkgdeps} || $comp->{preinstall} || $comp->{preupgrade} || $comp->{preuninstall}) { + + #Create debian directory for this kit component preppackage + + if (&gen_kitcomp_debdir_prep($comp, \%repo)) { return 1; } + $::VALID_PREP_COMPONENT = 1; + + # build prep deb + my $prep_compversion = $comp->{version} . "-" . $comp->{release}; + my $prep_buildstring = "Prep Kit component build package."; + my $prep_debbuilddir = $::workdir . "/debbuild/" . "prep-" . $comp->{kitcompname}; + my $prep_debianbuildcmd = "cd $prep_debbuilddir;debchange -v $prep_compversion -b -c debian/changelog $prep_buildstring;dpkg-buildpackage $dpkg_flag"; + + if (system($prep_debianbuildcmd)) { + print "Error running \"dpkg-buildpackage $dpkg_flag\" command for kit component prep-$comp->{kitcompname} meta package\n"; + return 1; + } + } + + #Create debian directory for this kit component metapackage + + if (&gen_kitcomp_debdir($comp, \%repo, 'METADEB')) { return 1; } + + } else { + + #Create debian directory for this kit component + + if (&gen_kitcomp_debdir($comp, \%repo, 'ALL')) { return 1; } + + } + + + + if (defined($comp->{non_native_pkgs})) { + my $sourcedir = $::workdir . "/source_packages"; + + foreach my $pkgfile (split(/,/, $comp->{non_native_pkgs})) { + my $pkg_file; + my ($key, $value) = split /:/, $pkgfile; + if ("$key" =~ /EXTERNALPKGS/) { + $pkg_file = $value; + } else { + $pkg_file = $key; + } + + $cmd = "cp -p $sourcedir/$pkg_file $debbuilddir"; + if (system($cmd)) { + print "Error copying non-native package file $sourcedir/$pkg_file to debbuilddir\n"; + return 1; + } + } + } + my $compversion = $comp->{version} . "-" . $comp->{release}; + my $buildstring = "\'Kit component build package.\'"; + my $debianbuildcmd = "cd $debbuilddir;debchange -v $compversion -b -c debian/changelog $buildstring;dpkg-buildpackage $dpkg_flag"; + if (!$::NON_NATIVE_PKGS->{ $comp->{kitcompname} }) { + if (system($debianbuildcmd)) { + print "Error running \"dpkg-buildpackage $dpkg_flag\" command for kit component $comp->{kitcompname} meta package\n"; + return 1; + } + my $repodir = $::base_repodir . "/" . $repo{kitreponame}; + my @builtdebs = `find $::workdir/debbuild -maxdepth 1 -name "*.deb"`; + foreach my $deb (@builtdebs) { + chomp($deb); + if (system("cp -fp $deb $repodir")) { + print "Error copying package $deb to build repo directory $repodir \n"; + return 1; + } + } + } + return 0; +} + + +#----------------------------------------------------------------------------- + +=head3 gen_kitcomp_debdir_prep + + + +=cut + +#----------------------------------------------------------------------------- +sub gen_kitcomp_debdir_prep { + my $comp = shift; + my $repo = shift; + my $scriptdir = $::workdir . "/scripts/"; + my $combuilddir = $::workdir . "/debbuild/" . "prep-" . $comp->{kitcompname}; + + #copy the debian dir template to the build path + mkpath("$combuilddir/debian"); + my $cmd = "cp -Rf " . $::XCATSHARE . "/kits/debian_template/* $combuilddir/debian/"; + system($cmd); + + my $kitname = $::bldkit_config->{kit}{entries}[0]->{basename}; + my $kitcompname = "prep-" . $comp->{kitcompname}; + my $upgradeflag = "pre-" . $comp->{basename} . ".tmp"; + + my ($prescript, $postscript, $preupscript, $postupscript, $preunscript, $postunscript, $nonnativepkgs) = ''; + if (defined($comp->{preinstall})) { + $prescript = &load_script("$scriptdir$comp->{preinstall}"); + } + if (defined($comp->{preupgrade})) { + $preupscript = &load_script("$scriptdir$comp->{preupgrade}"); + } + if (defined($comp->{preuninstall})) { + $preunscript = &load_script("$scriptdir$comp->{preuninstall}"); + } + + #replace all special sub string in all files under debian + unless (opendir(DH, "${combuilddir}/debian/")) { + print "Can not open the xCAT Kit Component debian dir: ${combuilddir}/debian/"; + return 1; + } + + foreach (readdir(DH)) { + my $file = "${combuilddir}/debian/$_"; + if (-d $file) { + next; + } + + unless (open(FH, "<", $file)) { + print "Error attempting to open the xCAT Kit Component ${kitcompname}'s debian template file $file.\n"; + close(DH); + return 1; + } + + if ($::VERBOSE) { + print "Reading the xCAT Kit Component ${kitcompname}'s debian template file $file. \n"; + } + my @lines = ; + close(FH); + my $prep_comp_name = "prep-" . $comp->{basename}; + for (@lines) { + chomp; + s/<<>>/$prep_comp_name/; + s/<<>>/$comp->{ospkgdeps}/; + s/<<>>//; + s/<<>>//; + s/<<>>/$comp->{description}/; + s/<<>>/$upgradeflag/; + s/<<>>/$prescript/; + s/<<>>//; + s/<<>>/$preupscript/; + s/<<>>//; + s/<<>>/$preunscript/; + s/<<>>//; + + } + my $joined_lines = join("\n", @lines); + @lines = split(/\\n/, $joined_lines); + + open(FH, ">", $file); + if ($::VERBOSE) { + print "Created kitcomponent ${kitcompname}'s build file under debian dir $file"; + } + print FH @lines; + close(FH); + } + closedir(DH); + + return 0; +} + + + +#----------------------------------------------------------------------------- + +=head3 gen_kitcomp_debdir + + + +=cut + +#----------------------------------------------------------------------------- +sub gen_kitcomp_debdir { + my $comp = shift; + my $repo = shift; + my $level = shift; + my $scriptdir = $::workdir . "/scripts/"; + my $combuilddir = $::workdir . "/debbuild/" . $comp->{kitcompname}; + + #copy the debian dir template to the build path + mkpath("$combuilddir/debian"); + my $cmd = "cp -Rf " . $::XCATSHARE . "/kits/debian_template/* $combuilddir/debian/"; + system($cmd); + + my $kitname = $::bldkit_config->{kit}{entries}[0]->{basename}; + my $kitcompname = $comp->{kitcompname}; + my $upgradeflag = $comp->{basename} . ".tmp"; + + my ($prescript, $postscript, $preupscript, $postupscript, $preunscript, $postunscript, $nonnativepkgs) = ''; + + if ($level eq 'METADEB' || $level eq 'ALL') + { + if (defined($comp->{postinstall})) { + $postscript = &load_script("$scriptdir$comp->{postinstall}"); + } + + if (defined($comp->{postupgrade})) { + $postupscript = &load_script("$scriptdir$comp->{postupgrade}"); + } + if (defined($comp->{postuninstall})) { + $postunscript = &load_script("$scriptdir$comp->{postuninstall}"); + } + if (defined($comp->{non_native_pkgs})) { + $nonnativepkgs = "\n"; + $nonnativepkgs .= "mkdir -p \$RPM_BUILD_ROOT/opt/xcat/kits/$kitname/$kitcompname \n"; + $nonnativepkgs .= "cp -a * \$RPM_BUILD_ROOT/opt/xcat/kits/$kitname/$kitcompname \n"; + } + } + if ($level eq 'ALL') + { + if (defined($comp->{preinstall})) { + $prescript = &load_script("$scriptdir$comp->{preinstall}"); + } + if (defined($comp->{preupgrade})) { + $preupscript = &load_script("$scriptdir$comp->{preupgrade}"); + } + if (defined($comp->{preuninstall})) { + $preunscript = &load_script("$scriptdir$comp->{preuninstall}"); + } + } + + + #replace all special sub string in all files under debian + unless (opendir(DH, "${combuilddir}/debian/")) { + print "Can not open the xCAT Kit Component debian dir: ${combuilddir}/debian/"; + return 1; + } + + foreach (readdir(DH)) { + my $file = "${combuilddir}/debian/$_"; + if (-d $file) { + next; + } + + unless (open(FH, "<", $file)) { + print "Error attempting to open the xCAT Kit Component ${kitcompname}'s debian template file $file.\n"; + close(DH); + return 1; + } + + if ($::VERBOSE) { + print "Reading the xCAT Kit Component ${kitcompname}'s debian template file $file. \n"; + } + my @lines = ; + close(FH); + my $prepcomp = "prep-" . $comp->{basename}; + for (@lines) { + chomp; + s/<<>>/$comp->{basename}/; + s/<<>>/$comp->{ospkgdeps}/; + s/<<>>/$comp->{kitpkgdeps}/; + if ($::VALID_PREP_COMPONENT) { +s/<<>>/$comp->{kitcompdeps},$prepcomp/; + } + else + { +s/<<>>/$comp->{kitcompdeps}/; + } + + s/<<>>/$comp->{description}/; + s/<<>>/$upgradeflag/; + s/<<>>/$prescript/; + s/<<>>/$postscript/; + s/<<>>/$preupscript/; + s/<<>>/$postupscript/; + s/<<>>/$preunscript/; +s/<<>>/$postunscript/; + } + my $joined_lines = join("\n", @lines); + @lines = split(/\\n/, $joined_lines); + + open(FH, ">", $file); + if ($::VERBOSE) { + print "Created kitcomponent ${kitcompname}'s build file under debian dir $file"; + } + print FH @lines; + close(FH); + } + closedir(DH); + + if (defined($comp->{non_native_pkgs})) { + unless (open(FH, ">", "${combuilddir}/debian/dir")) { + print "Error attempting to open the xCAT Kit Component ${kitcompname}'s debian file dir.\n"; + return 1; + } + print FH "opt/xcat/kits/$kitname/$kitcompname/"; + close(FH); + + unless (open(FH, ">", "${combuilddir}/debian/install")) { + print "Error attempting to open the xCAT Kit Component ${kitcompname}'s debian file dir.\n"; + return 1; + } + foreach my $pkgfile (split(/,/, $comp->{non_native_pkgs})) { + my $pkgname = ''; + my ($key, $value) = split /:/, $pkgfile; + if ("$key" =~ /EXTERNALPKGS/) { + $pkgname = $value; + } else { + $pkgname = $key; + } + print FH "$pkgname opt/xcat/kits/$kitname/$kitcompname/ \n"; + } + close(FH); + } + return 0; +} + +#----------------------------------------------------------------------------- + +=head3 load_script + + load a kitcomponent script into a single return string + with imbedded newline chars + input: fullpath of scriptname + +=cut + +#----------------------------------------------------------------------------- +sub load_script +{ + my $scriptname = shift; + my $SF; + unless (open($SF, "<", $scriptname)) { + print "Error attempting to open the file $scriptname. \n"; + return; + } + if ($::VERBOSE) { + print "Reading the file $scriptname. \n"; + } + my @lines = <$SF>; + close $SF; + + my $script_contents = join('', @lines); + return $script_contents; +} + +#----------------------------------------------------------------------------- + +=head3 create_kitconf + + Create the kit configuration file to put into the kit tar file. + +=cut + +#----------------------------------------------------------------------------- +sub create_kitconf +{ + # Build kit config file entries from buildkit config input + my $kitname = $::bldkit_config->{kit}{entries}[0]->{kitname}; + foreach my $s (keys %{$::bldkit_config}) { + if (!defined($::buildkit_def{$s})) { next; } + if ($s eq 'kitpackage') { next; } + my $li = 0; + foreach my $se (@{ $::bldkit_config->{$s}{entries} }) { + $::kit_config->{$s}{entries}[$li]->{kitname} = $kitname; + + # copy all defined attrs over + foreach my $a (keys %{ $::buildkit_def{$s} }) { + if (($::buildkit_def{$s}{$a}->{cp_to_kitconfig} eq '1') && + (defined($se->{$a}))) { + if ($s eq 'kitcomponent') { + if ($a eq 'kitpkgdeps') { + my $value; + foreach my $d (split(/,/, $se->{$a})) { + $d =~ s/\s+//g; + $d =~ s/^([\w\.\-]+)[<>=]*.*$/$1/; + $value .= "$d,"; + } + $value =~ s/(\,)*$//; + $se->{$a} = $value; + } + } + $::kit_config->{$s}{entries}[$li]->{$a} = $se->{$a}; + } + + # cp_to_kitconfig=2 means copy the file to the new kit + # but only do the copy if this is a final kit build + if (($::buildkit_def{$s}{$a}->{cp_to_kitconfig} eq '2') && + (defined($se->{$a})) && + !$::HAVE_EXTERNAL_PKG && !$::HAVE_NON_NATIVE_PKGS) { + my $prefix = "$kitname"; + if ($s eq 'kitcomponent') { + $prefix = "$::bldkit_config->{$s}{entries}[$li]->{kitcompname}"; + if (($a eq 'postbootscripts') || + ($a eq 'genimage_postinstall')) { + $prefix = "KIT_" . $prefix; + } + if (!($::kit_config->{$s}{entries}[$li]->{$a} = + &cp_to_builddir($a, $se->{$a}, $::workdir . '/' . $::buildkit_def{$s}{$a}->{base_dir}, $prefix, $::bldkit_config->{$s}{entries}[$li]))) { + return 1; + } + } else { + if (!($::kit_config->{$s}{entries}[$li]->{$a} = + &cp_to_builddir($a, $se->{$a}, $::workdir . '/' . $::buildkit_def{$s}{$a}->{base_dir}, $prefix))) { + return 1; + } + } + } + } + + # Handle special attrs, these 3 attributes did not defined in the buildkit.conf, special cases. + if ($s eq 'kitrepo') { + $::kit_config->{$s}{entries}[$li]->{kitreponame} = + $se->{kitreponame}; + } elsif ($s eq 'kitcomponent') { + $::kit_config->{$s}{entries}[$li]->{kitcompname} = + $se->{kitcompname}; + $::kit_config->{$s}{entries}[$li]->{kitreponame} = + $se->{kitreponame}; + if (!$::PREREQUISITE and ($se->{ospkgdeps} || $se->{preinstall} || $se->{preupgrade} || $se->{preuninstall})) { + if ($debianflag) { + $::kit_config->{$s}{entries}[$li]->{prerequisite} = + "prep-" . $se->{basename}; + } else { + $::kit_config->{$s}{entries}[$li]->{prerequisite} = + "prep_" . $se->{basename}; + } + } + } + $li++; + } + } + + # Handle external packages + if ($::HAVE_EXTERNAL_PKG) { + foreach my $kp (@{ $::bldkit_config->{kitpackage}{entries} }) { + if ($kp->{isexternalpkg} eq 'yes') { + my %current_entry; + $current_entry{filename} = $kp->{filename}; + $current_entry{kitreponame} = $kp->{kitreponame}; + push(@{ $::kit_config->{EXTERNALPKG}{'entries'} }, {%current_entry}); + } + } + } + + + # Handle non_native_pkgs + foreach my $kc (@{ $::bldkit_config->{kitcomponent}{entries} }) { + if ($::NON_NATIVE_PKGS->{ $kc->{kitcompname} }) { + my @nativefiles; + foreach my $pkgfile (split(/,/, $kc->{non_native_pkgs})) { + my ($key, $value) = split /:/, $pkgfile; + if ("$key" =~ /EXTERNALPKGS/) { + push(@nativefiles, $value); + } + } + + my %current_entry; + $current_entry{filename} = join ',', @nativefiles; + $current_entry{kitcompname} = $kc->{kitcompname}; + $current_entry{basename} = $kc->{basename}; + $current_entry{kitreponame} = $kc->{kitreponame}; + push(@{ $::kit_config->{NONNATIVEPKGS}{'entries'} }, {%current_entry}); + } + } + + + # Write Kit Config File + my @lines; + my $li = 0; + $lines[ $li++ ] = "# Kit Configuration File for $kitname generated by buildkit\n"; + $lines[ $li++ ] = "kitbuildinfo: \n"; + my $xCAT_buildkit_version = ''; + if ($debianflag) { + $xCAT_buildkit_version = `dpkg-query --show -f='\${Version}' xcat-buildkit`; + } + else { + $xCAT_buildkit_version = `rpm -q --qf \"%{VERSION}-%{RELEASE}\" xCAT-buildkit`; + } + $lines[ $li++ ] = " xCAT_version = $xCAT_buildkit_version \n"; + $lines[ $li++ ] = " build_date = " . localtime() . "\n"; + $lines[ $li++ ] = " kitframework = $::KITFRAMEWORK \n"; + $lines[ $li++ ] = " compatible_kitframeworks = $::COMPATIBLE_KITFRAMEWORKS \n"; + + foreach my $s ('kit', 'kitrepo', 'kitcomponent', 'EXTERNALPKG', 'NONNATIVEPKGS') { + foreach my $se (@{ $::kit_config->{$s}{entries} }) { + $lines[ $li++ ] = "$s: \n"; + foreach my $a (keys %{$se}) { + $lines[ $li++ ] = " $a = $se->{$a} \n"; + } + } + } + + if ((!-d $::deploy_dir) && (!mkpath($::deploy_dir))) { + print "Error creating build directory $::deploy_dir.\n"; + return; + } + + my $full_kit_conf = $::deploy_dir . "/" . $::kit_conf; + my $NCF; + unless (open($NCF, ">$full_kit_conf")) { + return 1; + } + if ($::VERBOSE) { + print "Wrote new kit configuration file $full_kit_conf \n"; + } + print $NCF @lines; + close($NCF); + + return 0; +} + +#----------------------------------------------------------------------------- + +=head3 cp_to_builddir + + Copy specified files into the build directory renaming as indicated + and substituting strings if needed + +=cut + +#----------------------------------------------------------------------------- +sub cp_to_builddir +{ + my $type = shift; + my $files = shift; + my $from_dir = shift; + my $prefix = shift; + my $kitcomp = shift; + + my $copied_files; + my $other_files = $::deploy_dir . "/other_files"; + if ((!-d $other_files) && (!mkpath($other_files))) { + print "Error creating build directory $other_files.\n"; + return; + } + foreach my $file (split(/\,/, $files)) { + $file =~ s/\s+//g; + my $from_file = $from_dir . "/" . $file; + my $from_file_base = basename($file); + my $to_file_base = $prefix . "_" . $from_file_base; + my $to_file = $other_files . "/" . $to_file_base; + + # Read in the file + my $FF; + unless (open($FF, "<", $from_file)) { + print "The Kit file $from_file could not be read. \n"; + return 1; + } + my @lines = <$FF>; + for (@lines) { +s/<<>>/$::bldkit_config->{kit}{entries}[0]->{kitname}/g; +s/<<>>/$::bldkit_config->{kit}{entries}[0]->{basename}/g; +s/<<>>/$::bldkit_config->{kit}{entries}[0]->{version}/g; +s/<<>>/$::bldkit_config->{kit}{entries}[0]->{release}/g; + if (defined($kitcomp)) { +s/<<>>/$kitcomp->{kitcompname}/g; +s/<<>>/$kitcomp->{basename}/g; +s/<<>>/$kitcomp->{version}/g; +s/<<>>/$kitcomp->{release}/g; + } + } + + # Write the file back out + my $TF; + unless (open($TF, ">$to_file")) { + print "Error copying file $from_file to build directory $other_files \n"; + return 1; + } + if ($::VERBOSE) { + print "Copied $from_file to $to_file replacing kit and kitcomponent strings as needed. \n"; + } + print $TF @lines; + close($TF); + + $copied_files .= ",$to_file_base"; + + if (($type eq 'postbootscripts') || + ($type eq 'genimage_postinstall')) { + system("chmod 755 $to_file"); + } + } + $copied_files =~ s/^\,//; + return $copied_files; +} + +#----------------------------------------------------------------------------- + +=head3 create_builddir + + Create the build directory and copy in all required files for building + the kit tar file. + +=cut + +#----------------------------------------------------------------------------- +sub create_builddir +{ + my $kitname = $::bldkit_config->{kit}{entries}[0]->{kitname}; + + # Note: + # - repos already created and validated + # - kit.conf file already created + # - exlists, postbootscripts, and deployparams already copied + + # copy plugins to build dir and edit to insert correct plugin and kit names + my $plugin_dir = $::deploy_dir . "/plugins"; + if (-d "$::workdir/plugins") { + if ((!-d $plugin_dir) && (!mkpath($plugin_dir))) { + print "Error creating build directory $plugin_dir.\n"; + return 1; + } + + foreach my $plugin (<$::workdir/plugins/*.pm>) { + my $plugin_base = basename($plugin); + my $mod_kitname = $kitname; + $mod_kitname =~ s/\-/\_/g; + $mod_kitname =~ s/\./\_/g; + my $to_plugin = $plugin_dir . "/" . $mod_kitname . "_" . $plugin_base; + + if (system("cp -fp $plugin $to_plugin")) { + + # non-zero return from system call + print "Error copying plugin file $plugin to build directory $plugin_dir \n"; + return 1; + } + if (&edit_plugin($to_plugin)) { return 1; } + } + } + + # copy docs to build dir + if (-d "$::workdir/docs") { + if (system("cp -fRp $::workdir/docs $::deploy_dir")) { + + # non-zero return from system call + print "Error copying doc files $::workdir/docs to build directory $::deploy_dir \n"; + return 1; + } + } + + # Edit deploy params file to make sure correct format for xCAT + if (defined($::kit_config->{kit}{entries}[0]->{kitdeployparams})) { + my $kd_file = $::deploy_dir . "/other_files/" . $::kit_config->{kit}{entries}[0]->{kitdeployparams}; + if (&edit_deployparams($kd_file)) { return 1; } + } + + if ($::HAVE_EXTERNAL_PKG or $::HAVE_NON_NATIVE_PKGS) { + + # Copy the kitcomponent meta rpm spec if there is external non_native_pkgs. + if ($debianflag) { + foreach my $comp (keys %{$::NON_NATIVE_PKGS}) { + my $kitrepo; + foreach my $kc (@{ $::bldkit_config->{kitcomponent}{entries} }) { + if ($comp eq $kc->{kitcompname}) { + $kitrepo = $kc->{kitreponame} + } + } + mkpath("$::deploy_dir/tmp/"); + my $cmd = "cp -fRP $::workdir/debbuild/$comp $::deploy_dir/tmp/$comp"; + if (system("$cmd")) { + print "Error copying kitcomponent meta debian build file $::workdir/debbuild/$comp to build directory $::deploy_dir \n"; + return 1; + } + } + } + + # Copy over the original buildkit.conf file and input files + # to help make addpkgs processing easier later + mkpath("$::deploy_dir/build_input/"); + if (system("cp -fp $::full_buildkit_conf $::deploy_dir/build_input")) { + + # non-zero return from system call + print "Error copying buildkit config file $::full_buildkit_conf to build directory $::deploy_dir/build_input \n"; + return 1; + } + } + return 0; +} + +#----------------------------------------------------------------------------- + +=head3 create_PARTIAL_builddir + + Create the build directory for a PARTIAL kit (needs external pkgs) + and copy in all required files for building the kit tar file. + This includes most build input without editting files since + they will need to be generated at addpkgs time. + +=cut + +#----------------------------------------------------------------------------- +sub create_PARTIAL_builddir +{ + my $kitname = $::bldkit_config->{kit}{entries}[0]->{kitname}; + + # Note: + # - repos already created and validated + # - kit.conf file already created + # - exlists, postbootscripts, and deployparams already copied + + # copy docs to build dir + if (-d "$::workdir/docs") { + if (system("cp -fRp $::workdir/docs $::deploy_dir")) { + + # non-zero return from system call + print "Error copying doc files $::workdir/docs to build directory $::deploy_dir \n"; + return 1; + } + } + + # Copy over the original buildkit.conf file and input files + # to help make addpkgs processing easier later + mkpath("$::deploy_dir/build_input/"); + if (system("cp -fp $::full_buildkit_conf $::deploy_dir/build_input")) { + + # non-zero return from system call + print "Error copying buildkit config file $::full_buildkit_conf to build directory $::deploy_dir/build_input \n"; + return 1; + } + if (-d "$::workdir/other_files") { + if (system("cp -fpR $::workdir/other_files $::deploy_dir/build_input")) { + + # non-zero return from system call + print "Error copying $::workdir/otherfiles to build directory $::deploy_dir/build_input \n"; + return 1; + } + } + if (-d "$::workdir/plugins") { + if (system("cp -fpR $::workdir/plugins $::deploy_dir/build_input")) { + + # non-zero return from system call + print "Error copying $::workdir/plugins to build directory $::deploy_dir/build_input \n"; + return 1; + } + } + if (-d "$::workdir/scripts") { + if (system("cp -fpR $::workdir/scripts $::deploy_dir/build_input")) { + + # non-zero return from system call + print "Error copying $::workdir/scripts to build directory $::deploy_dir/build_input \n"; + return 1; + } + } + + # Copy over any provided non-native packages + my $to_source_dir = "$::deploy_dir/build_input/source_packages"; + mkpath("$to_source_dir"); + foreach my $kc (@{ $::bldkit_config->{kitcomponent}{entries} }) { + if (defined($kc->{non_native_pkgs})) { + my $sourcedir = $::workdir . "/source_packages"; + foreach my $pkgfile (split(/,/, $kc->{non_native_pkgs})) { + my $pkg_file; + my ($key, $value) = split /:/, $pkgfile; + if ("$key" =~ /EXTERNALPKGS/) { + next; + } else { + $pkg_file = $key; + } + + my $cmd = "cp -p $sourcedir/$pkg_file $to_source_dir"; + if (system($cmd)) { + print "Error copying non-native package file $sourcedir/$pkg_file to $to_source_dir \n"; + return 1; + } + } + } + } + + return 0; +} + +#----------------------------------------------------------------------------- + +=head3 edit_deployparams + + Edit the kit deployment parameters to make sure it has correct + syntax for xCAT otherpkglist support + + +=cut + +#----------------------------------------------------------------------------- +sub edit_deployparams +{ + my $file = shift; + my $validate_only = shift; + + # read in the file + my $DF; + unless (open($DF, "<", $file)) { + print "The Kit deployment parameters file $file could not be read. \n"; + return 1; + } + my @lines = <$DF>; + close $DF; + + # Edit the files + my $changed = 0; + my @new_lines; + my $ln = 0; + foreach my $l (@lines) { + $ln++; + + # skip blank lines + if ($l =~ /^\s*$/) { + push(@new_lines, $l); + next; + } + + # #ENV lines + $l =~ s/^\s+//; # compress leading blanks + if ($l =~ /^\#ENV\:/) { + if (!($l =~ /\#\s*$/)) { + chomp $l; + $l .= "#\n"; + $changed = 1; + } + push(@new_lines, $l); + next; + } + + # skip all other comments + if ($l =~ /^\s*#/) { + push(@new_lines, $l); + next; + } + + # Add #ENV if not specified + if ($l =~ /^\w*\s*\=/) { + chomp $l; + $l = "#ENV: $l #"; + $changed = 1; + push(@new_lines, $l); + next; + } + + # Syntax error + print "Syntax error in kit deployment parameters file $file \n"; + print "line $ln: \n"; + print "$l \n"; + return 1; + } + + # Write the file back out + if ($changed && !$validate_only) { + my $NDF; + unless (open($NDF, ">$file")) { + return 1; + } + if ($::VERBOSE) { + print "Editted kit deployment parameters file $file \n"; + } + print $NDF @lines; + close($NDF); + } + return 0; +} + +#----------------------------------------------------------------------------- + +=head3 edit_plugin + + Edit the kit plugin file to insert the full kit name + + +=cut + +#----------------------------------------------------------------------------- +sub edit_plugin +{ + my $file = shift; + my $kitname = $::bldkit_config->{kit}{entries}[0]->{kitname}; + + # convert dashes to underscore since the kitname is used as perl pkg names + # in the plugin and this causes perl syntax errors + my $mod_kitname = $kitname; + $mod_kitname =~ s/\-/\_/g; + $mod_kitname =~ s/\./\_/g; + + # read in the file + my $PF; + unless (open($PF, "<", $file)) { + print "The Kit plugin file $file could not be read. \n"; + return 1; + } + my @lines = <$PF>; + close $PF; + + for (@lines) { + s/<<>>/$kitname/g; + s/<<>>/$mod_kitname/g; + } + + # Write the plugin back out + my $NPF; + unless (open($NPF, ">$file")) { + return 1; + } + if ($::VERBOSE) { + print "Inserted kitname values into $file \n"; + } + print $NPF @lines; + close($NPF); + + return 0; +} + +#----------------------------------------------------------------------------- + +=head3 kit_addpkgs + + buildkit addpkgs + +=cut + +#----------------------------------------------------------------------------- +sub kit_addpkgs +{ + # add RPM pkgs to an existing kit tarfile + my $kittarfile = $::KIT_ADDPKGS; + my $kitbfname = basename($kittarfile); + $kitbfname =~ s/.tar.bz2$//; + $kitbfname =~ s/.NEED_PRODUCT_PKGS$//; + my $tmpdir_base = "/tmp/$kitbfname"; + + # - could be list of pkgdir s + my @pkgdirlist = split(",", $::PKGDIR); + + print "$tmpdir_base\n"; + # Cleanup - should have been removed when last command ran + # - but just in case + system("rm -Rf $tmpdir_base"); + + # the tar file may not be in the current dir + $kittarfile = "$::workdir/$kittarfile"; + + if (!(-r $kittarfile)) { + print "The Kit tar file $kittarfile could not be read. \n"; + return 1; + } + $kittarfile = abs_path($kittarfile); + + foreach my $rpmdir (@pkgdirlist) { + if (!(-d $rpmdir)) { + print "The package directory $rpmdir could not be read. \n"; + return 1; + } + } + + # Create work directory + if ((!-d $tmpdir_base) && (!mkpath($tmpdir_base))) { + print "Error creating temporary work directory $tmpdir_base\n"; + return 1; + } + + print "Extracting tar file $kittarfile. Please wait.\n"; + + if (system("cd $tmpdir_base; tar -jxf $kittarfile ")) { + print "Error extracting tarfile $kittarfile \n"; + + # Cleanup + system("rm -Rf $tmpdir_base"); + return 1; + } + + my $tmp_kit_conf = `find $tmpdir_base -name kit.conf`; + chomp($tmp_kit_conf); + my $tmpdir = dirname($tmp_kit_conf); + + # read in the file + my $CKF; + unless (open($CKF, "<", $tmp_kit_conf)) { + print "The Kit configuration file $tmp_kit_conf could not be read or was not included in the kit tar file. \n"; + + # Cleanup + system("rm -Rf $tmpdir_base"); + return 1; + } + my @lines = <$CKF>; + close $CKF; + + $::PREREQUISITE = 1; + foreach my $l (@lines) { + + # skip blank and comment lines + if ($l =~ /^\s*$/ || $l =~ /^\s*#/) { + next; + } + if ($l =~ /prerequisite/) { + $::PREREQUISITE = 0; + } + } + + # + # check contents of kit.conf to make sure the framework + # is compatible with this codes framework + $::kitframework = &check_framework(\@lines); + if (!defined($::kitframework)) { + return 1; + } + + # if this in not a partial kit then the framework must be 2 or greater + my $kit_name = basename($kittarfile); + if ((!($kit_name =~ /NEED_PRODUCT_PKGS/)) && ($::kitframework < 2)) { + print "This kit cannot be updated. To update a complete kit the kit framework\n value must be greater than or equal to 2. You can use the\n\t\'lskit -F \' \ncommand to check the framework value of the kit.\n"; + return 1; + } + + ### Check if this is a new partial kit built with xCAT 2.8.1 or newer + if (-d "$tmpdir/build_input") { + system("mv $tmpdir/build_input $tmpdir_base"); + return &NEW_kit_addpkgs($tmpdir_base, $tmpdir); + } + + ### OLD KITS BUILT PRIOR TO xCAT 2.8.1 + ### this code will eventually become obsolete and should be removed + ### do not update + if (defined($::KITVERSION) || defined($::KITRELEASE)) { + print "kitversion and kitrelease substitution is not supported for this incomplete kit. Run \"buildkit addpkgs\" without the \"-k|--kitversion\" and \"-r| --kitrelease\" options. \n"; + exit 1; + } + + my $rpmdir = $::PKGDIR; + + my $ext_filename = ''; + my $ext_reponames = ''; + my $non_native_filename = ''; + my $non_native_kitcompname = ''; + my $non_native_basename = ''; + my $non_native_kitreponame = ''; + my %create_repodata_list; + my @new_lines; + my $section = ''; + my $kitname = ''; + my $kitbasename = ''; + my $kitversion = ''; + my $kitostype = ''; + + foreach my $l (@lines) { + + # skip blank and comment lines + if ($l =~ /^\s*$/ || $l =~ /^\s*#/) { + push(@new_lines, $l); + next; + } + + # new section? + if ($l =~ /^\s*(\w+)\s*:/) { + $section = $1; + if ($section eq 'EXTERNALPKG') { + $ext_filename = ''; + $ext_reponames = ''; + next; + } + if ($section eq 'NONNATIVEPKGS') { + $non_native_filename = ''; + $non_native_kitcompname = ''; + $non_native_basename = ''; + $non_native_kitreponame = ''; + next; + } + push(@new_lines, $l); + next; + } + if ($l =~ /^\s*(\w+)\s*=\s*(.*)\s*/) { + my $attr = $1; + my $val = $2; + my $orig_attr = $attr; + my $orig_val = $val; + $attr =~ s/^\s*//; # Remove any leading whitespace + $attr =~ s/\s*$//; # Remove any trailing whitespace + $attr =~ tr/A-Z/a-z/; # Convert to lowercase + $val =~ s/^\s*//; + $val =~ s/\s*$//; + + + if ($section eq 'kit') { + if ($attr eq 'basename') { $kitbasename = $val; } + if ($attr eq 'version') { $kitversion = $val; } + if ($attr eq 'ostype') { $kitostype = $val; } + if (($kitbasename ne '') && ($kitversion ne '') && + ($kitostype ne '')) { + $kitname = "$kitbasename-$kitversion-$kitostype"; + } + } + + if ($section eq 'EXTERNALPKG') { + if ($attr eq 'filename') { + $ext_filename = $val; + } elsif ($attr eq 'kitreponame') { + $ext_reponames = $val; + } else { + next; + } + if (($ext_filename ne '') && ($ext_reponames ne '')) { + my $fromfile = $rpmdir . "/" . $ext_filename; + if (system("ls $fromfile > /dev/null")) { + print "The product package file $ext_filename could not be read from the package directory $rpmdir. \n"; + + # Cleanup + system("rm -Rf $tmpdir_base"); + return 1; + } + foreach my $repo (split(/,/, $ext_reponames)) { + my $repodir = $tmpdir . "/repos/" . $repo; + if (!-d ($repodir) && (!mkpath($repodir))) { + print "Error creating repository directory $repodir\n"; + + # Cleanup + system("rm -Rf $tmpdir_base"); + return 1; + } + if (system("cp -fp $fromfile $repodir")) { + print "Error copying package file $fromfile to $repodir \n"; + + # Cleanup + system("rm -Rf $tmpdir_base"); + return 1; + } + $create_repodata_list{$repodir} = 1; + } + } + next; + } + + if ($section eq 'NONNATIVEPKGS') { + if ($attr eq 'filename') { + $non_native_filename = $val; + } elsif ($attr eq 'kitcompname') { + $non_native_kitcompname = $val; + } elsif ($attr eq 'basename') { + $non_native_basename = $val; + } elsif ($attr eq 'kitreponame') { + $non_native_kitreponame = $val; + } else { + next; + } + if (($non_native_filename ne '') + && ($non_native_kitcompname ne '') + && ($non_native_basename ne '') + && ($non_native_kitreponame ne '')) { + + #find out the useful dir + my $tdir = $tmpdir . "/tmp/"; + my $source_dir = "$tdir/$non_native_kitcompname"; + my $spec = "$tdir/$non_native_kitcompname.spec"; + if (!-d "$tdir" or !-d "$source_dir") { + print "Error open kitcomponent rpm build direcotry $tdir or $tdir/$non_native_kitcompname \n"; + + # Cleanup + system("rm -Rf $tmpdir_base"); + return 1; + } + + #copy the nan_native_pkgs to the source dir + foreach my $tepmfilename (split(/,/, $non_native_filename)) { + + #the $non_native_filename may contain several pkgs, can check and copy at the same time + my $fromfile = $rpmdir . "/" . $tepmfilename; + if (system("ls $fromfile > /dev/null")) { + print "The product package file $non_native_filename could not be read from the package directory $rpmdir. \n"; + system("rm -Rf $tmpdir_base"); + return 1; + } + if (system("cp -fp $fromfile $tdir/$non_native_kitcompname")) { + print "Error copying package file $fromfile to $tdir/$non_native_kitcompname \n"; + + # Cleanup + system("rm -Rf $tmpdir_base"); + return 1; + } + } + + #for debian/ubuntu + my $repodir = $tmpdir . "/repos/" . $non_native_kitreponame; + if ($debianflag) { + my $debbuildcmd = "cd $source_dir;dpkg-buildpackage $dpkg_flag"; + if (system($debbuildcmd)) { + print "error running debian build cmd for kit component $non_native_basename meta package.\n"; + return 1; + } + my @debs = `find $tdir -maxdepth 1 -name "*.deb"`; + foreach my $debname (@debs) { + chomp($debname); + if (system("mv -f $debname $repodir")) { + print "Error copying package $debname to build repo directory $repodir. \n"; + return 1; + } + } + } + else { + if (!-r "$spec") { + print "Error open kitcomponent rpm build spec $tdir/$non_native_kitcompname.spec \n"; + + # Cleanup + system("rm -Rf $tmpdir_base"); + return 1; + } + my $rpmbuild_dir = $tmpdir . "/rpmbuild"; + my $cmd = "rm -Rf $rpmbuild_dir"; + system($cmd); + + my $avoiderr = $rpmbuild_dir . "/BUILDROOT/"; + mkpath($avoiderr); + $avoiderr = $rpmbuild_dir . "/BUILD/"; + mkpath($avoiderr); + $avoiderr = $rpmbuild_dir . "/SRPMS/"; + mkpath($avoiderr); + $avoiderr = $rpmbuild_dir . "/RPMS/noarch/"; + mkpath($avoiderr); + + unless (open(SF, "<", $spec)) { + print "Error attempting to open spec $spec of kitcomponent $non_native_basename. \n"; + return 1; + } + + mkpath("$rpmbuild_dir/SOURCES"); + $cmd = "cd $source_dir/..;mv $non_native_kitcompname $non_native_basename; tar -czf $rpmbuild_dir/SOURCES/$non_native_basename.tar.gz $non_native_basename;mv $non_native_basename $non_native_kitcompname;"; + if (system($cmd)) { + print "Error creating tarfile $rpmbuild_dir/SOURCES/$non_native_basename.tar from $source_dir/*"; + return 1; + } + my $rpmbuild_cmd = "rpmbuild --define \"_topdir $rpmbuild_dir\" -ba $spec"; + if (!$::VERBOSE) { + $rpmbuild_cmd .= ' --quiet '; + } + if (system($rpmbuild_cmd)) { + print "Error running rpmbuild command for kit component $non_native_basename meta package\n"; + return 1; + } + + # Copy the built meta rpm to repo + my @built_rpms = `find $rpmbuild_dir/RPMS -name "*.rpm"`; + foreach my $rpm (@built_rpms) { + chomp($rpm); + if (system("cp -fp $rpm $repodir")) { + print "Error copying rpm $rpm to build repo directory $repodir \n"; + return 1; + } + } + } + $create_repodata_list{$repodir} = 1; + } + next; + } + + push(@new_lines, $l); + } + } + + # Re-write kit.conf with EXTERNALPKG and NONNATIVEPKGS sections removed + my $NCF; + unless (open($NCF, ">$tmp_kit_conf")) { + return 1; + } + print $NCF @new_lines; + close($NCF); + + # Clean up RPMBUILD and tmp in kit directory + my $cmd = "rm -Rf $tmpdir/tmp"; + system("$cmd"); + unless ($debianflag) { + $cmd = "rm -Rf $tmpdir/rpmbuild"; + system("$cmd"); + } + + # Run createrepo for each updated directory + foreach my $repo (keys(%create_repodata_list)) { + my $createrepocmd = ''; + if ($debianflag) { + $createrepocmd = "cd $repo;dpkg-scanpackages . > Packages"; + } + else { + $createrepocmd = "createrepo $repo"; + } + if (system($createrepocmd )) { + print "Error running $createrepocmd. \n"; + + # Cleanup + system("rm -Rf $tmpdir_base"); + return 1; + } + } + + # Create new tar file in current directory + my $new_tarfile = $::workdir . '/' . $kitbfname . '.tar.bz2'; + if (system("cd $tmpdir; cd ..; tar -cjhf $new_tarfile $kitname/*")) { + print "Error building tarfile $new_tarfile \n"; + + # Cleanup + system("rm -Rf $tmpdir_base"); + return 1; + } + print "Kit tar file $new_tarfile successfully built \n"; + + # Cleanup + system("rm -Rf $tmpdir_base"); + return 0; +} + +#----------------------------------------------------------------------------- + +=head3 NEW_kit_addpkgs + + buildkit addpkgs + +=cut + +#----------------------------------------------------------------------------- +sub NEW_kit_addpkgs +{ + # add RPM pkgs to an existing kit tarfile + my $tmpdir_base = shift; + my $tmpdir = shift; + + # - could be list of pkgdir dirs + my @pkgdirlist = split(",", $::PKGDIR); + + $::NEW_PARTIAL_KIT = 1; + $::workdir = "$tmpdir_base/build_input"; + $::full_buildkit_conf = $::workdir . "/" . $::buildkit_conf; + $::deploy_dir = $tmpdir_base; #kitname appended by validate_bldkitconf routine + + my $tmp_buildkit_conf = `find $tmpdir_base -name $::buildkit_conf`; + + chomp($tmp_buildkit_conf); + if ($tmp_buildkit_conf ne $::full_buildkit_conf) { + print "$tmp_buildkit_conf should match $::full_buildkit_conf .... error??? \n"; + } + + my $loadrc = &load_bldkitconf($tmp_buildkit_conf); + if ($loadrc != 0) { + print "Error reading buildkit config file $tmp_buildkit_conf \n"; + return 1; + } + + if (defined($::KITVERSION)) { + $::bldkit_config->{kit}{entries}[0]->{version} = $::KITVERSION; + } + if (defined($::KITRELEASE)) { + $::bldkit_config->{kit}{entries}[0]->{release} = $::KITRELEASE; + } + + my $chkrc = &validate_bldkitconf(); + if ($chkrc != 0) { + print "Error validating buildkit config file $tmp_buildkit_conf \n"; + return 1; + } + + if ($tmpdir ne $::deploy_dir) { + if (system("mv $tmpdir $::deploy_dir ")) { + print "Error moving $tmpdir to $::deploy_dir \n"; + return 1; + } + } + $::build_dir = $::deploy_dir; + $::base_repodir = "$::deploy_dir/repos"; + my $kitname = $::bldkit_config->{kit}{entries}[0]->{kitname}; + + # Handle external packages + if ($::HAVE_EXTERNAL_PKG) { + foreach my $kp (@{ $::bldkit_config->{kitpackage}{entries} }) { + if ($kp->{isexternalpkg} eq 'yes') { + my $ext_filename = $kp->{filename}; + my $ext_reponames = $kp->{kitreponame}; + my $files; + if ($debianflag) { + $files = xCAT::BuildKitUtils->find_latest_pkg_deb(\@pkgdirlist, $ext_filename); + } + else { + $files = xCAT::BuildKitUtils->find_latest_pkg(\@pkgdirlist, $ext_filename); + } + if (!defined($files)) { + print "Error: The product package file $ext_filename was not found in the package directory(s) @pkgdirlist.\n"; + + # Cleanup + system("rm -Rf $tmpdir_base"); + return 1; + } + + my @fromfiles = @$files; + + foreach my $repo (split(/,/, $ext_reponames)) { + my $repodir = $::base_repodir . "/" . $repo; + if (!-d ($repodir) && (!mkpath($repodir))) { + print "Error creating repository directory $repodir\n"; + + # Cleanup + system("rm -Rf $tmpdir_base"); + return 1; + } + + foreach my $fromfile (@fromfiles) { + if (system("cp -fp $fromfile $repodir")) { + print "Error copying package file $fromfile to $repodir \n"; + + # Cleanup + system("rm -Rf $tmpdir_base"); + return 1; + } + } + if ($::VERBOSE) { + print "Copied @fromfiles\n to $repodir\n"; + } + } + } + } + } + + # Handle non_native_pkgs + # Comma-separated list of non-native package + # paths that will be included as files in this kit + # component. + # these are not RPMs! + my $to_source_dir = "$::workdir/source_packages"; + mkpath("$to_source_dir"); + foreach my $kc (@{ $::bldkit_config->{kitcomponent}{entries} }) { + if ($::NON_NATIVE_PKGS->{ $kc->{kitcompname} }) { + my @nativefiles; + foreach my $pkgfile (split(/,/, $kc->{non_native_pkgs})) { + my ($key, $value) = split /:/, $pkgfile; + if ("$key" =~ /EXTERNALPKGS/) { + + #the $non_native_filename may contain several pkgs, can check and copy at the same time + foreach my $nnpkg (split(/,/, $value)) { + my $found = 0; + foreach my $pdir (@pkgdirlist) { + my $fromfile = $pdir . "/" . $nnpkg; + if (system("ls $fromfile > /dev/null")) { + next; + } else { + $found++; + if (system("cp -fp $fromfile $to_source_dir")) { + print "Error copying package file $fromfile to $to_source_dir \n"; + + # Cleanup + system("rm -Rf $tmpdir_base"); + next; + } else { + if ($::VERBOSE) { + print "Copied $fromfile to $to_source_dir\n"; + } + } + } + } + if (!$found) { + print "Could not find $nnpkg.\n"; + } + } + } + } + } + } + + # Turn off external pkg flags and build the kit component meta pkgs + $::HAVE_EXTERNAL_PKG = ''; + $::HAVE_NON_NATIVE_PKGS = ''; + $::NON_NATIVE_PKGS = {}; + + foreach my $kc (@{ $::bldkit_config->{kitcomponent}{entries} }) { + my $rc = 0; + if ($debianflag) { + $rc = &build_kitcomp_debian($kc); + } + else { + $rc = &build_kitcomp($kc); + } + if ($rc) { + print "Error building kitcomponent metapackage for $kc->{basename} \n"; + return 1; + } + } + + # run createrepo + foreach my $kr (@{ $::bldkit_config->{kitrepo}{entries} }) { + my $repodir = "$::base_repodir/$kr->{kitreponame}"; + if (-d $repodir) { + my $cr_opts = ''; + if (($kr->{osbasename} =~ m/rh|RH|centos|CentOS/) && + ($kr->{osmajorversion} eq '5')) { + $cr_opts = '-s md5'; + } + my $repocmd = ""; + if ($debianflag) { + $repocmd = "cd $repodir;dpkg-scanpackages . > Packages"; + } + else { + $repocmd = "createrepo $cr_opts $repodir"; + } + if (system($repocmd )) { + print "Error building the repository meta-data with the createrepo command \n"; + return 1; + } + } + } + + + #When using -k -r, there are useless repodir + #delete useless repo dir + my $kitrepodirby = $::base_repodir; + my $cmdby = "/bin/ls $kitrepodirby 2>/dev/null"; + my $outputby = `$cmdby`; + my @allrepolist = split(/\n/, $outputby); + my @dellist; + + foreach my $reponame (@allrepolist) + { + my $match = 0; + foreach my $kr (@{ $::bldkit_config->{kitrepo}{entries} }) + { + my $repodirname = "$kr->{kitreponame}"; + + if (${repodirname} eq ${reponame}) + { + ${match}++; + } + } + if (${match} == 0) + { + push(@dellist, $reponame); + } + } + + foreach my $del (@dellist) + { + my $delrepodir = $::base_repodir . "/" . $del; + if (-d $delrepodir) + { + my $delcmd = "rm -Rf $delrepodir"; + if (system($delcmd)) + { + print "Failed to delete useless repo directory \n"; + } + } + } + + + # Build the full kit tar file + my $buildtar_rc = &kit_buildtar; + + # clean out the tmp dir + system("rm -Rf $tmpdir_base"); + + if ($buildtar_rc) { + print "Error building full kit tarfile \n"; + return 1; + } + return 0; +} + +#----------------------------------------------------------------------------- + +=head3 check_framework + + Check the compatible frameworks of the kit to see if it is + compatible with the running code. + + If one of the compatible frameworks of the kit matches one of the + compatible frameworks of the running code then we're good. + + NOTE: compatible_kitframeworks are the kitframeworks that I can add + and kit frameworks that I can be added to. + + Returns: + 0 - kit framework value + undef - error + + Example: + my $kitframework = &check_framework(\@lines); + +=cut + +#----------------------------------------------------------------------------- +sub check_framework +{ + my $lines = shift; + + my @kitconflines = @$lines; + + my $kitbasename; + my $kitcompat; + my $kitframework; + my $section = ''; + foreach my $l (@kitconflines) { + + # skip blank and comment lines + if ($l =~ /^\s*$/ || $l =~ /^\s*#/) { + next; + } + + if ($l =~ /^\s*(\w+)\s*:/) { + $section = $1; + next; + } + + if ($l =~ /^\s*(\w+)\s*=\s*(.*)\s*/) { + my $attr = $1; + my $val = $2; + $attr =~ s/^\s*//; # Remove any leading whitespace + $attr =~ s/\s*$//; # Remove any trailing whitespace + $attr =~ tr/A-Z/a-z/; # Convert to lowercase + $val =~ s/^\s*//; + $val =~ s/\s*$//; + + if ($section eq 'kitbuildinfo') { + if ($attr eq 'compatible_kitframeworks') { + $kitcompat = $val; + } + if ($attr eq 'kitframework') { + $kitframework = $val; + } + } + if ($section eq 'kit') { + if ($attr eq 'basename') { $kitbasename = $val; } + } + } + } + + if (!$kitcompat) { + print "Warning: Could not determine the kit compatible framework values for \'$kitbasename\' from the kit.conf file. Continuing for now.\n"; + return 0; + } + + my @kit_compat_list = split(',', $kitcompat); + my @my_compat_list = split(',', $::COMPATIBLE_KITFRAMEWORKS); + + foreach my $myfw (@my_compat_list) { + chomp $myfw; + foreach my $kitfw (@kit_compat_list) { + chomp $kitfw; + + if ($myfw eq $kitfw) { + return $kitframework; + } + } + } + print "Error: The kit named \'$kitbasename\' is not compatible with this version of the buildkit command. \'$kitbasename\' is compatible with \'$kitcompat\' and the buildkit command is compatible with \'$::COMPATIBLE_KITFRAMEWORKS\'\n"; + return undef; +} diff --git a/xCAT-buildkit/xCAT-buildkit.spec b/xCAT-buildkit/xCAT-buildkit.spec index 2b7d550a4..8531dac38 100644 --- a/xCAT-buildkit/xCAT-buildkit.spec +++ b/xCAT-buildkit/xCAT-buildkit.spec @@ -35,6 +35,8 @@ xCAT-buildkit provides the buildkit tool and sample kit files to build an xCAT k # Convert pods to man pages and html pages mkdir -p share/man/man1 mkdir -p share/doc/man1 +pod2man pods/man1/buildkit.1.pod > share/man/man1/buildkit.1 +pod2html pods/man1/buildkit.1.pod > share/doc/man1/buildkit.1.html %install rm -rf $RPM_BUILD_ROOT @@ -44,18 +46,30 @@ mkdir -p $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/man/man1 mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/man1 +# These were built dynamically in the build phase +cp share/man/man1/* $RPM_BUILD_ROOT/%{prefix}/share/man/man1 +chmod 444 $RPM_BUILD_ROOT/%{prefix}/share/man/man1/* +cp share/doc/man1/* $RPM_BUILD_ROOT/%{prefix}/share/doc/man1 +chmod 644 $RPM_BUILD_ROOT/%{prefix}/share/doc/man1/* + %ifos linux cp -aR share/xcat/kits/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/kits/ +#chmod -R 644 $RPM_BUILD_ROOT/%{prefix}/share/xcat/kits/* find $RPM_BUILD_ROOT/%{prefix}/share/xcat/kits -type d -exec chmod 755 {} \; find $RPM_BUILD_ROOT/%{prefix}/share/xcat/kits -type f -exec chmod 644 {} \; cp -a lib/perl/xCAT/* $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT +#chmod -R 644 $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/* find $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT -type d -exec chmod 755 {} \; find $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT -type f -exec chmod 644 {} \; +cp -a bin/* $RPM_BUILD_ROOT/%{prefix}/bin/ +chmod -R 755 $RPM_BUILD_ROOT/%{prefix}/bin/* %else cp -hpR share/xcat/kits/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/kits/ chmod -R 644 $RPM_BUILD_ROOT/%{prefix}/share/xcat/kits/* cp -hpR lib/perl/xCAT/* $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/ chmod -R 755 $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/* +cp -hpR bin/* $RPM_BUILD_ROOT/%{prefix}/bin/ +chmod -R 755 $RPM_BUILD_ROOT/%{prefix}/bin/* %endif mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT-buildkit From 85f3f56b884eebcdea6cf5095b3394add1f75f15 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 3 Oct 2019 11:47:04 -0400 Subject: [PATCH 28/58] Revert "Remove kit links" This reverts commit ac3ae5630fd89633599e4664f4b2f4c327e91e97. --- xCAT-client/debian/xcat-client.links | 8 ++++++++ xCAT-client/xCAT-client.spec | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/xCAT-client/debian/xcat-client.links b/xCAT-client/debian/xcat-client.links index cc310d33f..0bf090cd8 100644 --- a/xCAT-client/debian/xcat-client.links +++ b/xCAT-client/debian/xcat-client.links @@ -92,6 +92,14 @@ opt/xcat/bin/xcatclient opt/xcat/bin/lshwconn opt/xcat/bin/xcatclientnnr opt/xcat/sbin/makeroutes opt/xcat/bin/xcatclientnnr opt/xcat/sbin/snmove opt/xcat/bin/xcatclientnnr opt/xcat/bin/lsxcatd +opt/xcat/bin/xcatclientnnr opt/xcat/bin/lskit +opt/xcat/bin/xcatclientnnr opt/xcat/bin/addkit +opt/xcat/bin/xcatclientnnr opt/xcat/bin/rmkit +opt/xcat/bin/xcatclientnnr opt/xcat/bin/lskitcomp +opt/xcat/bin/xcatclientnnr opt/xcat/bin/addkitcomp +opt/xcat/bin/xcatclientnnr opt/xcat/bin/rmkitcomp +opt/xcat/bin/xcatclientnnr opt/xcat/bin/chkkitcomp +opt/xcat/bin/xcatclientnnr opt/xcat/bin/lskitdeployparam opt/xcat/bin/xcatclient opt/xcat/bin/postage opt/xcat/bin/xcatclient opt/xcat/bin/cfghost opt/xcat/bin/xcatclientnnr opt/xcat/bin/cfgve diff --git a/xCAT-client/xCAT-client.spec b/xCAT-client/xCAT-client.spec index 69b2c34d1..5b44dabcf 100644 --- a/xCAT-client/xCAT-client.spec +++ b/xCAT-client/xCAT-client.spec @@ -249,6 +249,14 @@ ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/cfghost ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/cfgve ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/lsve ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/rmosdistro +ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/lskit +ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/addkit +ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/rmkit +ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/lskitcomp +ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/addkitcomp +ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/rmkitcomp +ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/chkkitcomp +ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/lskitdeployparam ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/lskmodules ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/nodeimport ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/nodediscoverstart From 3c2b70a104b41ad4439eea8c31bd666299df87d5 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 3 Oct 2019 15:09:24 -0400 Subject: [PATCH 29/58] Remove comments that kits were removed --- xCAT-server/share/xcat/tools/go-xcat | 4 ---- 1 file changed, 4 deletions(-) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index 290916800..dc402a8a8 100755 --- a/xCAT-server/share/xcat/tools/go-xcat +++ b/xCAT-server/share/xcat/tools/go-xcat @@ -23,10 +23,6 @@ # - xCAT uninstallation # 2019-03-22 GONG Jie # - Better debug log when reading repository failed -# 2019-07-24 Mark Gurevich -# - Removed references to buildkit -# 2019-08-12 Mark Gurevich -# - Added xCAT-buildkit to uninstall list # 2019-08-15 Mark Gurevich # - Added conserver-xcat to uninstall list # From dbb66408221e6dd96b2f69e0ae886c6e2ede7c63 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 7 Oct 2019 13:25:26 -0400 Subject: [PATCH 30/58] OpenBMC fixes for OP940 changes [Python] --- xCAT-openbmc-py/lib/python/agent/common/rest.py | 6 ++++-- xCAT-openbmc-py/lib/python/agent/hwctl/openbmc_client.py | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/xCAT-openbmc-py/lib/python/agent/common/rest.py b/xCAT-openbmc-py/lib/python/agent/common/rest.py index e82485c6d..54fb5b4eb 100644 --- a/xCAT-openbmc-py/lib/python/agent/common/rest.py +++ b/xCAT-openbmc-py/lib/python/agent/common/rest.py @@ -15,10 +15,12 @@ from . import exceptions as xcat_exception class RestSession(object): - def __init__(self): + def __init__(self, auth=None): self.session = requests.Session() self.cookies = None - self.auth = None + # If userid and password were passed in, use them for basic authorization + # This is required to connect to BMC with OP940 level, ignored for lower OP levels + self.auth = auth def request(self, method, url, headers, data=None, timeout=30): diff --git a/xCAT-openbmc-py/lib/python/agent/hwctl/openbmc_client.py b/xCAT-openbmc-py/lib/python/agent/hwctl/openbmc_client.py index 3f1565833..2ce1a547e 100644 --- a/xCAT-openbmc-py/lib/python/agent/hwctl/openbmc_client.py +++ b/xCAT-openbmc-py/lib/python/agent/hwctl/openbmc_client.py @@ -248,12 +248,12 @@ RSPCONFIG_APIS = { EVENTLOG_URLS = { "list": "/logging/enumerate", - "clear_all": "/logging/action/deleteAll", + "clear_all": "/logging/action/DeleteAll", "resolve": "/logging/entry/{}/attr/Resolved", } RAS_POLICY_TABLE = "/opt/ibm/ras/lib/policyTable.json" -RAS_POLICY_MSG = "Install the OpenBMC RAS package to obtain more details logging messages." +RAS_POLICY_MSG = "Install the OpenBMC RAS package to obtain more detailed logging messages." RAS_NOT_FOUND_MSG = " Not found in policy table: " RESULT_OK = 'ok' @@ -279,7 +279,7 @@ class OpenBMCRest(object): # print back to xcatd or just stdout self.messager = kwargs.get('messager') - self.session = rest.RestSession() + self.session = rest.RestSession((self.username,self.password)) self.root_url = HTTP_PROTOCOL + self.bmcip + PROJECT_URL self.download_root_url = HTTP_PROTOCOL + self.bmcip + '/' From 85101a7c3c3aef525886594e7fbf0acde2ddecb2 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 9 Oct 2019 11:59:37 -0400 Subject: [PATCH 31/58] Workflow Guide document fixes --- .../guides/get-started/workflow_guide.rst | 50 +++++++++---------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/docs/source/guides/get-started/workflow_guide.rst b/docs/source/guides/get-started/workflow_guide.rst index 49bedef5b..0cb1f594b 100644 --- a/docs/source/guides/get-started/workflow_guide.rst +++ b/docs/source/guides/get-started/workflow_guide.rst @@ -1,71 +1,69 @@ Workflow Guide ============== -If xCAT looks suitable for your requirement, following steps are recommended procedure to set up an xCAT cluster. +If xCAT looks suitable for your requirement, following steps are recommended to set up an xCAT cluster. -#. Find a server as your xCAT management node +#. Find a server for xCAT management node - The server can be a bare-metal server or a virtual machine. The major factor for selecting a server is the number of machines in your cluster. The bigger the cluster is, the performance of server need to be better. + The server can be a bare-metal server or a virtual machine. The major factor for selecting a server is the number of machines in your cluster. The bigger the cluster is, the performance of server need to be better. - ``NOTE``: The architecture of xCAT management node is recommended to be same as the target compute node in the cluster. + The architecture of xCAT management node is recommended to be same as the target compute node in the cluster. #. Install xCAT on your selected server - The server which installed xCAT will be the **xCAT Management Node**. + The server where xCAT is installed will be the **xCAT Management Node**. - Refer to the doc: :doc:`xCAT Install Guide <../guides/install-guides/index>` to learn how to install xCAT on a server. + Refer to the doc: :doc:`xCAT Install Guide ` to learn how to install xCAT on a server. -#. Start to use xCAT management node + Refer to the doc: :doc:`xCAT Admin Guide ` to learn how to manage xCAT Management server. - Refer to the doc: :doc:`xCAT Admin Guide <../guides/admin-guides/index>`. +#. Discover target compute nodes in the cluster -#. Discover target nodes in the cluster + Define the target nodes in the xCAT database before managing them. - You have to define the target nodes in the xCAT database before managing them. + For a small cluster (less than 5), you can collect the information of target nodes one by one and then define them manually through ``mkdef`` command. - For a small cluster (less than 5), you can collect the information of target nodes one by one and then define them manually through ``mkdef`` command. + For a bigger cluster, you can use the automatic method to discover the target nodes. The discovered nodes will be defined to xCAT database. You can use ``lsdef`` to display them. - For a bigger cluster, you can use the automatic method to discover the target nodes. The discovered nodes will be defined to xCAT database. You can use ``lsdef`` to display them. + Refer to the doc: :doc:`xCAT discovery Guide ` to learn how to discover and define compute nodes. - Refer to the doc: :doc:`xCAT discovery Guide <../guides/admin-guides/manage_clusters/ppc64le/discovery/index>` to learn how to discover and define compute nodes. +#. Perform hardware control operations against the target compute nodes -#. Try to perform the hardware control against the target nodes + Verify the hardware control for defined nodes. e.g. ``rpower stat``. - Now you have the node definition. Verify the hardware control for defined nodes is working. e.g. ``rpower stat``. - - Refer to the doc: :doc:`Hardware Management <../guides/admin-guides/manage_clusters/ppc64le/management/index>` to learn how to perform the remote hardware control. + Refer to the doc: :doc:`Hardware Management ` to learn how to perform the remote hardware control. #. Deploy OS on the target nodes - * Prepare the OS images - * Customize the OS images (Optional) - * Perform the OS deployment + * Prepare the OS images + * Customize the OS images (Optional) + * Perform the OS deployment - Refer to the doc: :doc:`Diskful Install <../guides/admin-guides/manage_clusters/ppc64le/diskful/index>`, :doc:`Diskless Install <../guides/admin-guides/manage_clusters/ppc64le/diskless/index>` to learn how to deploy OS for a target node. + Refer to the doc: :doc:`Diskful Install `, :doc:`Diskless Install ` to learn how to deploy OS for a target node. #. Update the OS after the deployment - You may require to update the OS of certain target nodes after the OS deployment, try the ``updatenode`` command. ``updatenode`` command can execute the following tasks for target nodes: + You may require to update the OS of certain target nodes after the OS deployment, try the ``updatenode`` command. ``updatenode`` command can execute the following tasks for target nodes: * Install additional software/application for the target nodes * Sync some files to the target nodes * Run some postscript for the target nodes - Refer to the doc: :doc:`Updatenode <../guides/admin-guides/manage_clusters/ppc64le/updatenode>` to learn how to use ``updatenode`` command. + Refer to the doc: :doc:`Updatenode ` to learn how to use ``updatenode`` command. #. Run parallel commands -When managing a cluster with hundreds or thousands of nodes, operating on many nodes in parallel might be necessary. xCAT has some parallel commands for that. + When managing a cluster with hundreds or thousands of nodes, operating on many nodes in parallel might be necessary. xCAT has some parallel commands for that. * Parallel shell * Parallel copy * Parallel ping - Refer to the :doc:`/guides/admin-guides/manage_clusters/ppc64le/parallel_cmd` to learn how to use parallel commands. + Refer to the :doc:`/guides/admin-guides/manage_clusters/ppc64le/parallel_cmd` to learn how to use parallel commands. #. Contribute to xCAT (Optional) -While using xCAT, if you find something (code, documentation, ...) that can be improved and you want to contribute that to xCAT, do that for your and other xCAT users benefit. And welcome to xCAT community! + While using xCAT, if you find something (code, documentation, ...) that can be improved and you want to contribute that to xCAT, do that for your and other xCAT users benefit. And welcome to xCAT community! Refer to the :doc:`/developers/index` to learn how to contribute to xCAT community. From 41f73fff85c842f3e4a560fab6686d77ecb9267f Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 10 Oct 2019 10:17:27 -0400 Subject: [PATCH 32/58] Add delay to nodeset testcase --- xCAT-test/autotest/testcase/nodeset/cases0 | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-test/autotest/testcase/nodeset/cases0 b/xCAT-test/autotest/testcase/nodeset/cases0 index 3550b3a22..2e807673c 100644 --- a/xCAT-test/autotest/testcase/nodeset/cases0 +++ b/xCAT-test/autotest/testcase/nodeset/cases0 @@ -223,6 +223,7 @@ check:rc!=0 cmd:chdef -t node -o testnode1 ip= check:rc==0 cmd:cp -f /etc/hosts.xcattestbak /etc/hosts +cmd:sleep 2 cmd:getent hosts testnode1 | grep testnode1 check:rc!=0 cmd:nodeset testnode1 osimage=rhels6.99-x86_64-install-compute From adc7ee5171ef89eea97c3d32a391fdeb6557587c Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 11 Oct 2019 12:26:55 -0400 Subject: [PATCH 33/58] Insert devel into xcat-dep repo file --- builddep.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/builddep.sh b/builddep.sh index 3344c2aa5..75235fa99 100755 --- a/builddep.sh +++ b/builddep.sh @@ -248,9 +248,6 @@ for i in `find -mindepth 2 -maxdepth 2 -type d `; do fi done -# Modify xcat-dep.repo files to point to the correct place -echo "===> Modifying the xcat-dep.repo files to point to the correct location..." - echo "===> Making sure that the mklocalrepo.sh file contains execute permission ..." ls -ltr ${XCATCOREDIR}/${WORKING_TARGET_DIR}/mklocalrepo.sh if [[ ! -x "${XCATCOREDIR}/${WORKING_TARGET_DIR}/mklocalrepo.sh" ]]; then @@ -294,6 +291,11 @@ echo "===> Creating $DFNAME ..." tar $verbosetar -jcf $DFNAME xcat-dep chmod a+r $DFNAME + +# Modify all xcat-dep.repo files to point to the correct place: $YUM +echo "===> Modifying the xcat-dep.repo files to point to the correct 'yum/devel' location..." +find ${WORKING_TARGET_DIR} -type f -name "xcat-dep.repo" -exec sed -i s#/yum/xcat-dep#/${YUM}/xcat-dep#g {} \; + if [[ ${UP} -eq 0 ]]; then echo "Upload not being done, set UP=1 to upload to xcat.org" exit 0; From a5f72ad3a43c0dd994f59d88723cc547569d55ca Mon Sep 17 00:00:00 2001 From: cxhong Date: Mon, 14 Oct 2019 14:50:40 -0400 Subject: [PATCH 34/58] remove node definition from rscan --- xCAT-test/autotest/testcase/rscan/cases0 | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/xCAT-test/autotest/testcase/rscan/cases0 b/xCAT-test/autotest/testcase/rscan/cases0 index 636920a00..6f411c88b 100644 --- a/xCAT-test/autotest/testcase/rscan/cases0 +++ b/xCAT-test/autotest/testcase/rscan/cases0 @@ -24,6 +24,7 @@ end start:rscan_w label:others,hctrl_hmc hcp:hmc +cmd:lsdef -t node all -z > /tmp/all.stanza cmd:lsdef -t node -l $$CN -z > /tmp/$$CN.stanza check:rc==0 cmd:perl -pi -e 's/$$CN/testnode/g' /tmp/$$CN.stanza @@ -37,14 +38,15 @@ check:output=~hmc\s+__GETNODEATTR($$CN,hcp)__+\s+\w{4}-\w{3}\s+\w{7} cmd:lsdef -l $$CN check:rc==0 check:output=~hcp=__GETNODEATTR($$CN,hcp)__ -cmd:rmdef $$CN,testnode -cmd:perl -pi -e 's/testnode/$$CN/g' /tmp/$$CN.stanza -cmd:cat /tmp/$$CN.stanza | mkdef -z +cmd:rmdef all +cmd:cat /tmp/all.stanza | mkdef -z +cmd:rm -f /tmp/all.stanza cmd:rm -f /tmp/$$CN.stanza end start:rscan_x_w label:others,hctrl_hmc hcp:hmc +cmd:lsdef -t node all -z > /tmp/all.stanza cmd:lsdef -t node -l $$CN -z > /tmp/$$CN.stanza check:rc==0 cmd:perl -pi -e 's/$$CN/testnode/g' /tmp/$$CN.stanza @@ -56,14 +58,15 @@ check:output=~[\w-]+ cmd:lsdef -l $$CN check:rc==0 check:output=~hcp=__GETNODEATTR($$CN,hcp)__ -cmd:rmdef $$CN,testnode -cmd:perl -pi -e 's/testnode/$$CN/g' /tmp/$$CN.stanza -cmd:cat /tmp/$$CN.stanza | mkdef -z +cmd:rmdef all +cmd:cat /tmp/all.stanza | mkdef -z +cmd:rm -f /tmp/all.stanza cmd:rm -f /tmp/$$CN.stanza end start:rscan_z_w label:others,hctrl_hmc hcp:hmc +cmd:lsdef -t node all -z > /tmp/all.stanza cmd:lsdef -t node -l $$CN -z > /tmp/$$CN.stanza check:rc==0 cmd:perl -pi -e 's/$$CN/testnode/g' /tmp/$$CN.stanza @@ -75,9 +78,8 @@ check:output=~parent=[\w-]+ check:lsdef -l $$CN check:rc==0 check:output=~parent=[\w-]+ -cmd:rmdef $$CN,testnode -cmd:perl -pi -e 's/testnode/$$CN/g' /tmp/$$CN.stanza -cmd:cat /tmp/$$CN.stanza | mkdef -z +cmd:rmdef all +cmd:cat /tmp/all.stanza | mkdef -z +cmd:rm -f /tmp/all.stanza cmd:rm -f /tmp/$$CN.stanza end - From 9e82869d54163791698c0703ab898b45a5c49049 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 14 Oct 2019 16:57:22 -0400 Subject: [PATCH 35/58] Clean genimage before kdump test --- xCAT-test/autotest/testcase/kdump/linux_diskless_kdump | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/kdump/linux_diskless_kdump b/xCAT-test/autotest/testcase/kdump/linux_diskless_kdump index 0e0ba3104..3ef555b2d 100644 --- a/xCAT-test/autotest/testcase/kdump/linux_diskless_kdump +++ b/xCAT-test/autotest/testcase/kdump/linux_diskless_kdump @@ -47,6 +47,7 @@ check:rc==0 cmd:chdef -t node $$CN -p postscripts=enablekdump check:rc==0 +cmd:rmimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute @@ -70,10 +71,13 @@ check:rc==0 check:output=~\d\d:\d\d:\d\d cmd:xdsh $$CN "echo 'echo 1 > /proc/sys/kernel/sysrq; echo c > /proc/sysrq-trigger' > /tmp/kdump.trigger" cmd:xdsh $$CN "chmod 755 /tmp/kdump.trigger" + +cmd:xdsh $$CN "rpm -q at" cmd:xdsh $$CN "service atd start" -cmd:sleep 30 +check:rc==0 + cmd:xdsh $$CN "at now +1 minutes <<< /tmp/kdump.trigger" -cmd:sleep 600 +cmd:sleep 300 cmd:vmcorefile=`find /opt/xcat/share/xcat/tools/autotest/kdumpdir/ -name vmcore`;if [[ -s $vmcorefile ]]; then echo "this file is not empty";else echo "this file is empty"; fi check:output=~not empty From 84f6f9a63702a22fb64c3d9a1b6a364dc10b35f6 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 16 Oct 2019 17:16:37 -0400 Subject: [PATCH 36/58] Revert "Modify pkgdir for ubuntu16.04.5 x86 testcase" This reverts commit 328aafee2de45d4927017ce9b6ef927709aa9ba4. --- .../testcase/installation/reg_linux_diskless_installation_flat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 59aaa36b0..b048d547a 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat @@ -34,7 +34,7 @@ cmd:if [ ! -d /tmp/mountoutput ]; then mkdir -p /tmp/mountoutput; fi cmd:mount |sort > /tmp/mountoutput/file.org cmd:cat /tmp/mountoutput/file.org cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu18.04.2" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ ppc64(el|le) ]] && [[ "__GETNODEATTR($$CN,mgt)__" =~ "kvm" ]] ; then mkdir -p /install/custom/netboot/ubuntu; sed -e 's@linux-image-generic-hwe-18.04@linux-image-generic@g' /install/custom/netboot/ubuntu/compute.ubuntu18.04.2.ppc64el.pkglist; chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute pkglist=/install/custom/netboot/ubuntu/compute.ubuntu18.04.2.ppc64el.pkglist; fi -cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute; fi +cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -p pkgdir="http://archive.ubuntu.com/ubuntu xenial universe main,http://archive.ubuntu.com/ubuntu xenial-updates universe main,http://security.ubuntu.com/ubuntu xenial-security main restricted";fi cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 From fda16b6bdf73dd4c349c14ad87927a81efc422a1 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 16 Oct 2019 17:17:07 -0400 Subject: [PATCH 37/58] Revert "Modify pkgdir for ubuntu16.04.5 x86 testcase (2)" This reverts commit da5c7512116021cd1f3d314c59b145045418a0bc. --- ...nux_diskless_installation_flat_postscripts_failed | 2 +- .../reg_linux_diskless_installation_hierarchy | 2 +- xCAT-test/autotest/testcase/packimg/cases0 | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat_postscripts_failed b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat_postscripts_failed index 7b1bae418..41391a68f 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat_postscripts_failed +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat_postscripts_failed @@ -37,7 +37,7 @@ check:rc==0 cmd:if [ ! -d /tmp/mountoutput ]; then mkdir -p /tmp/mountoutput; fi cmd:mount |sort > /tmp/mountoutput/file.org cmd:cat /tmp/mountoutput/file.org -cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute; fi +cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -p pkgdir="http://archive.ubuntu.com/ubuntu xenial universe main,http://archive.ubuntu.com/ubuntu xenial-updates universe main,http://security.ubuntu.com/ubuntu xenial-security main restricted";fi cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute 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 478cfe9c5..bd8fe4876 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy @@ -37,7 +37,7 @@ check:rc==0 cmd:if [[ -f /test.synclist ]] ;then mv -f /test.synclist /test.synclist.bak;fi; cmd:echo "/test.synclist -> /test.synclist" > /test.synclist;chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=/test.synclist check:rc==0 -cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute; fi +cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -p pkgdir="http://archive.ubuntu.com/ubuntu xenial universe main,http://archive.ubuntu.com/ubuntu xenial-updates universe main,http://security.ubuntu.com/ubuntu xenial-security main restricted";fi cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 diff --git a/xCAT-test/autotest/testcase/packimg/cases0 b/xCAT-test/autotest/testcase/packimg/cases0 index 0d7347087..d04d92940 100644 --- a/xCAT-test/autotest/testcase/packimg/cases0 +++ b/xCAT-test/autotest/testcase/packimg/cases0 @@ -64,7 +64,7 @@ cmd:if [ -x /usr/bin/goconserver ]; then makegocons $$CN; else makeconservercf $ check:rc==0 cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg /rootimg.bak;fi cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz /rootimg.cpio.gz.bak;fi -cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute; fi +cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -p pkgdir="http://archive.ubuntu.com/ubuntu xenial universe main,http://archive.ubuntu.com/ubuntu xenial-updates universe main,http://security.ubuntu.com/ubuntu xenial-security main restricted";fi cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 @@ -109,7 +109,7 @@ cmd:if [ -x /usr/bin/goconserver ]; then makegocons $$CN; else makeconservercf $ check:rc==0 cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg /rootimg.bak;fi cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz /rootimg.cpio.gz.bak;fi -cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute; fi +cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -p pkgdir="http://archive.ubuntu.com/ubuntu xenial universe main,http://archive.ubuntu.com/ubuntu xenial-updates universe main,http://security.ubuntu.com/ubuntu xenial-security main restricted";fi cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 @@ -158,7 +158,7 @@ cmd:if [ -x /usr/bin/goconserver ]; then makegocons $$CN; else makeconservercf $ check:rc==0 cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg /rootimg.bak;fi cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.xz;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.xz /rootimg.cpio.xz.bak;fi -cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute; fi +cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -p pkgdir="http://archive.ubuntu.com/ubuntu xenial universe main,http://archive.ubuntu.com/ubuntu xenial-updates universe main,http://security.ubuntu.com/ubuntu xenial-security main restricted";fi cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 @@ -203,7 +203,7 @@ cmd:if [ -x /usr/bin/goconserver ]; then makegocons $$CN; else makeconservercf $ check:rc==0 cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg /rootimg.bak;fi cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz /rootimg.tar.gz.bak;fi -cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute; fi +cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -p pkgdir="http://archive.ubuntu.com/ubuntu xenial universe main,http://archive.ubuntu.com/ubuntu xenial-updates universe main,http://security.ubuntu.com/ubuntu xenial-security main restricted";fi cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 @@ -263,7 +263,7 @@ cmd:if [ -x /usr/bin/goconserver ]; then makegocons $$CN; else makeconservercf $ check:rc==0 cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg /rootimg.bak;fi cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz /rootimg.tar.gz.bak;fi -cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute; fi +cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -p pkgdir="http://archive.ubuntu.com/ubuntu xenial universe main,http://archive.ubuntu.com/ubuntu xenial-updates universe main,http://security.ubuntu.com/ubuntu xenial-security main restricted";fi cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 @@ -319,7 +319,7 @@ cmd:if [ -x /usr/bin/goconserver ]; then makegocons $$CN; else makeconservercf $ check:rc==0 cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg /rootimg.bak;fi cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.xz;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.xz /rootimg.tar.xz.bak;fi -cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute; fi +cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu16.04.5" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "x86" ]]; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -p pkgdir="http://archive.ubuntu.com/ubuntu xenial universe main,http://archive.ubuntu.com/ubuntu xenial-updates universe main,http://security.ubuntu.com/ubuntu xenial-security main restricted";fi cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 From 2987f224f6b51907a6d0fd708f9817221fa89239 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 17 Oct 2019 12:01:14 -0400 Subject: [PATCH 38/58] Template docs and stanzas fixes --- .../ppc64le/discovery/manually_define.rst | 19 ++++++++----------- .../discovery/schedule_environment.rst | 2 +- .../objects/node/ppc64le-ipmi.stanza | 4 ++-- .../objects/node/ppc64le-openbmc.stanza | 4 ++-- .../objects/node/ppc64lekvmguest.stanza | 4 ++-- xCAT/templates/objects/node/x86_64.stanza | 4 ++-- .../objects/node/x86_64kvmguest.stanza | 4 ++-- 7 files changed, 19 insertions(+), 22 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/discovery/manually_define.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/discovery/manually_define.rst index c0e7a156c..f0a7ff7ee 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/discovery/manually_define.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/discovery/manually_define.rst @@ -14,7 +14,6 @@ Execute ``mkdef`` command to define the node: :: The manually defined node will be like this:: - # lsdef cn1 Object name: cn1 bmc=50.0.101.1 bmcpassword=admin @@ -33,28 +32,26 @@ The manually defined node will be like this:: ``mkdef --template`` can be used to create node definitions easily from the typical node definition templates or existing node definitions, some examples: -* creating node definition "cn2" with an existing node definition "cn1" :: +* creating node definition "cn2" from an existing node definition "cn1" :: - # mkdef -t node -o cn2 --template cn1 mac=66:55:44:33:22:11 ip=172.12.139.2 bmc=172.11.139.2 - 1 object definitions have been created or modified. + mkdef -t node -o cn2 --template cn1 mac=66:55:44:33:22:11 ip=172.12.139.2 bmc=172.11.139.2 - except the attributes specified(``mac``, ``ip`` and ``bmc`` attribute here), other attibutes of the newly created node "cn2" inherit the values of template node "cn1" + except for the attributes specified (``mac``, ``ip`` and ``bmc``), other attributes of the newly created node "cn2" inherit the values of template node "cn1" -* creating a node definition "cn2" with the template "ppc64le-openbmc-template"(openbmc controlled ppc64le node) shipped by xCAT :: +* creating a node definition "cn2" with the template "ppc64le-openbmc-template" (openbmc controlled ppc64le node) shipped by xCAT :: - # mkdef -t node -o cn2 --template ppc64le-openbmc-template mac=66:55:44:33:22:11 ip=172.12.139.2 bmc=172.11.139.2 bmcpassword=USERID bmcusername=PASSW0RD - 1 object definitions have been created or modified. + mkdef -t node -o cn2 --template ppc64le-openbmc-template mac=66:55:44:33:22:11 ip=172.12.139.2 bmc=172.11.139.2 bmcusername=USERID bmcpassword=PASSW0RD the unspecified attributes of newly created node "cn2" will be assigned with the default values in the template to list all the node definition templates available in xCAT, run :: - # lsdef -t node --template + lsdef -t node --template to display the full definition of template "ppc64le-openbmc-template", run :: - # lsdef -t node --template ppc64le-openbmc-template + lsdef -t node --template ppc64le-openbmc-template - the mandatory attributes, which must be specified while creating definitions with templates, are denoted with the value ``MANDATORY:`` in template definition. + the mandatory attributes, which must be specified while creating definitions with templates, are denoted with the value ``MANDATORY:`` in template definition. the optional attributes, which can be specified optionally, are denoted with the value ``OPTIONAL:`` in template definition diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/discovery/schedule_environment.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/discovery/schedule_environment.rst index a1a0eb8f6..a556870b1 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/discovery/schedule_environment.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/discovery/schedule_environment.rst @@ -5,7 +5,7 @@ Management Node info:: MN Hostname: xcat1 MN NIC info for Management Network(Host network): eth1, 10.0.1.1/16 - MN NIC info for Service Network(FSP/BMC nework): eth2, 50.0.1.1/16 + MN NIC info for Service Network(FSP/BMC network): eth2, 50.0.1.1/16 Dynamic IP range for Hosts: 10.0.100.1-10.0.100.100 Dynamic IP range for FSP/BMC: 50.0.100.1-50.0.100.100 diff --git a/xCAT/templates/objects/node/ppc64le-ipmi.stanza b/xCAT/templates/objects/node/ppc64le-ipmi.stanza index 3b134926d..706e6edf6 100644 --- a/xCAT/templates/objects/node/ppc64le-ipmi.stanza +++ b/xCAT/templates/objects/node/ppc64le-ipmi.stanza @@ -8,8 +8,8 @@ ppc64le-template: bmcusername="MANDATORY:the username of the BMC" cons=ipmi groups=all - ip=OPTIONAL:the ip address of the node - mac=OPTIONAL:the mac of the node + ip="MANDATORY:the ip address of the node" + mac="MANDATORY:the mac of the node" mgt=ipmi netboot=petitboot nodetype=mp diff --git a/xCAT/templates/objects/node/ppc64le-openbmc.stanza b/xCAT/templates/objects/node/ppc64le-openbmc.stanza index 43af130a9..e4418f9a1 100644 --- a/xCAT/templates/objects/node/ppc64le-openbmc.stanza +++ b/xCAT/templates/objects/node/ppc64le-openbmc.stanza @@ -8,8 +8,8 @@ ppc64le-openbmc-template: bmcusername="MANDATORY:the username of the BMC" cons=openbmc groups=all - ip=OPTIONAL:the ip address of the node - mac=OPTIONAL:the mac of the node + ip="MANDATORY:the ip address of the node" + mac="MANDATORY:the mac of the node" mgt=openbmc netboot=petitboot nodetype=mp diff --git a/xCAT/templates/objects/node/ppc64lekvmguest.stanza b/xCAT/templates/objects/node/ppc64lekvmguest.stanza index b6e28d1f2..afa31e27e 100644 --- a/xCAT/templates/objects/node/ppc64lekvmguest.stanza +++ b/xCAT/templates/objects/node/ppc64lekvmguest.stanza @@ -4,8 +4,8 @@ ppc64lekvmguest-template: objtype=node arch=ppc64le groups=all - ip="OPTIONAL:the ip address of the kvm guest" - mac="OPTIONAL:the mac of the kvm guest" + ip="MANDATORY:the ip address of the kvm guest" + mac="MANDATORY:the mac of the kvm guest" mgt=kvm netboot=grub2 vmcpus=2 diff --git a/xCAT/templates/objects/node/x86_64.stanza b/xCAT/templates/objects/node/x86_64.stanza index b59a46066..a2ad508d8 100644 --- a/xCAT/templates/objects/node/x86_64.stanza +++ b/xCAT/templates/objects/node/x86_64.stanza @@ -10,8 +10,8 @@ x86_64-template: getmac=ipmi groups=all hcp= - ip="OPTIONAL:the ip address of the node" - mac="OPTIONAL:the mac of the node" + ip="MANDATORY:the ip address of the node" + mac="MANDATORY:the mac of the node" mgt=ipmi netboot=xnba serialport=0 diff --git a/xCAT/templates/objects/node/x86_64kvmguest.stanza b/xCAT/templates/objects/node/x86_64kvmguest.stanza index 52d8efb5c..5b2329477 100644 --- a/xCAT/templates/objects/node/x86_64kvmguest.stanza +++ b/xCAT/templates/objects/node/x86_64kvmguest.stanza @@ -4,8 +4,8 @@ x86_64kvmguest-template: objtype=node arch=x86_64 groups=all - ip="OPTIONAL:the ip address of the kvm guest" - mac="OPTIONAL:the mac of the kvm guest" + ip="MANDATORY:the ip address of the kvm guest" + mac="MANDATORY:the mac of the kvm guest" mgt=kvm netboot=xnba serialport=0 From aa93414e69e98c01b8c4f82b003bdc1e4f404084 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 17 Oct 2019 15:08:09 -0400 Subject: [PATCH 39/58] bmcdiscover node name when serial or mtm and mac not available --- xCAT-server/lib/xcat/plugins/bmcdiscover.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm index a16765531..8c979363b 100644 --- a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm @@ -1160,8 +1160,10 @@ sub bmcdiscovery_ipmi { $mtm = '' if ($mtm =~ /^0+$/); $serial = '' if ($serial =~ /^0+$/); - unless (($mtm or $serial) or $ipmac{$ip}) { - xCAT::MsgUtils->message("W", { data => ["BMC Type/Model and/or Serial and MAC Address is unavailable for $ip"] }, $::CALLBACK); + # To constract a node name need either mac or both mtm and serial + # Exit if mac AND one of mtm or serial is missing + if (!($mtm and $serial) and !$ipmac{$ip}) { + xCAT::MsgUtils->message("W", { data => ["BMC Type/Model and Serial or MAC Address is unavailable for $ip"] }, $::CALLBACK); return; } @@ -1292,8 +1294,10 @@ sub bmcdiscovery_openbmc{ $mtm = '' if ($mtm =~ /^0+$/); $serial = '' if ($serial =~ /^0+$/); - unless (($mtm or $serial) or $ipmac{$ip}) { - xCAT::MsgUtils->message("W", { data => ["Could not obtain Valid Model Type and/or Serial Number and MAC Address for BMC at $ip"] }, $::CALLBACK); + # To constract a node name need either mac or both mtm and serial + # Exit if mac AND one of mtm or serial is missing + if (!($mtm and $serial) and !$ipmac{$ip}) { + xCAT::MsgUtils->message("W", { data => ["BMC Type/Model and Serial or MAC Address is unavailable for $ip"] }, $::CALLBACK); return; } From f32620c86577709394842d1672ba2f2d30dda8fe Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 17 Oct 2019 16:39:35 -0400 Subject: [PATCH 40/58] Use the openbmc is and pw in the example --- .../manage_clusters/ppc64le/discovery/manually_define.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/discovery/manually_define.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/discovery/manually_define.rst index f0a7ff7ee..1e7ba95f0 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/discovery/manually_define.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/discovery/manually_define.rst @@ -40,7 +40,7 @@ The manually defined node will be like this:: * creating a node definition "cn2" with the template "ppc64le-openbmc-template" (openbmc controlled ppc64le node) shipped by xCAT :: - mkdef -t node -o cn2 --template ppc64le-openbmc-template mac=66:55:44:33:22:11 ip=172.12.139.2 bmc=172.11.139.2 bmcusername=USERID bmcpassword=PASSW0RD + mkdef -t node -o cn2 --template ppc64le-openbmc-template mac=66:55:44:33:22:11 ip=172.12.139.2 bmc=172.11.139.2 bmcusername=root bmcpassword=0penBmc the unspecified attributes of newly created node "cn2" will be assigned with the default values in the template From fee95d488267b0f35a5bc24ff4b74efc40414533 Mon Sep 17 00:00:00 2001 From: cxhong Date: Thu, 17 Oct 2019 17:48:59 -0400 Subject: [PATCH 41/58] modify nodeset return code for hierarchy support --- xCAT-server/lib/xcat/plugins/rinstall.pm | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/rinstall.pm b/xCAT-server/lib/xcat/plugins/rinstall.pm index 2eed25a01..899e91c06 100644 --- a/xCAT-server/lib/xcat/plugins/rinstall.pm +++ b/xCAT-server/lib/xcat/plugins/rinstall.pm @@ -389,14 +389,18 @@ sub rinstall { # if only provision one node and failed nodeset, will exit the command # instead of continue with rnetboot/rsetboot, rpower. + # check if it is hierarchy cluster if (scalar(@nodes) == 1) { - $rsp->{error}->[0] = "Failed to run 'nodeset' against the node: @nodes"; - $rsp->{errorcode}->[0] = 1; - xCAT::MsgUtils->message("E", $rsp, $callback); - return 1; + my $nrtab = xCAT::Table->new('noderes'); + my $sn = $nrtab->getNodeAttribs(@nodes,['servicenode']); + if (!$sn) { + $rsp->{error}->[0] = "Failed to run 'nodeset' against the node: @nodes"; + $rsp->{errorcode}->[0] = 1; + xCAT::MsgUtils->message("E", $rsp, $callback); + return 1; + } } - foreach my $node (@failurenodes) { delete $nodes{$node}; } From fe4db25042ce5931a234eaaa85ff07a4bf783c62 Mon Sep 17 00:00:00 2001 From: cxhong Date: Fri, 18 Oct 2019 12:00:26 -0400 Subject: [PATCH 42/58] modify rinstall for service node error --- xCAT-server/lib/xcat/plugins/rinstall.pm | 28 +++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/rinstall.pm b/xCAT-server/lib/xcat/plugins/rinstall.pm index 899e91c06..cc40b7b29 100644 --- a/xCAT-server/lib/xcat/plugins/rinstall.pm +++ b/xCAT-server/lib/xcat/plugins/rinstall.pm @@ -362,6 +362,8 @@ sub rinstall { # We got an error with the nodeset my @successnodes; my @failurenodes; + my @failuresns; + my $snfailure; # copy into a temporary variable to avoid of circular reference my @lines = @$res; foreach my $line (@lines) { @@ -384,16 +386,32 @@ sub rinstall { } return 1; } + + if ($line =~ /Unable to dispatch hierarchical sub-command to (\S+):3001/) { + $snfailure=1; + push @failuresns,$1; + } xCAT::MsgUtils->message("I", $rsp, $callback); } # if only provision one node and failed nodeset, will exit the command # instead of continue with rnetboot/rsetboot, rpower. - # check if it is hierarchy cluster - if (scalar(@nodes) == 1) { - my $nrtab = xCAT::Table->new('noderes'); - my $sn = $nrtab->getNodeAttribs(@nodes,['servicenode']); - if (!$sn) { + if ( (scalar(@nodes) == 1) ) { + #exit the command if it's service node failure + if ($snfailure) { + my $node = $nodes[0]; + my $nrtab = xCAT::Table->new('noderes'); + my $nrents = $nrtab->getNodeAttribs($node, [qw(servicenode)]); + my $nodesn = $nrents->{servicenode}; + foreach my $tmpsn (@failuresns) { + if ($nodesn eq $tmpsn) { + $rsp->{error}->[0] = "Unable connect to Service node $nodesn, failed to run 'nodeset' against the node: @nodes"; + $rsp->{errorcode}->[0] = 1; + xCAT::MsgUtils->message("E", $rsp, $callback); + return 1; + } + } + } else { $rsp->{error}->[0] = "Failed to run 'nodeset' against the node: @nodes"; $rsp->{errorcode}->[0] = 1; xCAT::MsgUtils->message("E", $rsp, $callback); From 159942dc9b10a7d93b5bd233ccc4ed0150c1363f Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 21 Oct 2019 16:48:44 -0400 Subject: [PATCH 43/58] Make bmcuser, bmcpassword and mac optional, but ip mandatory in template --- xCAT/templates/objects/node/ppc64le-ipmi.stanza | 6 +++--- xCAT/templates/objects/node/ppc64le-openbmc.stanza | 6 +++--- xCAT/templates/objects/node/ppc64lekvmguest.stanza | 2 +- xCAT/templates/objects/node/x86_64.stanza | 6 +++--- xCAT/templates/objects/node/x86_64kvmguest.stanza | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/xCAT/templates/objects/node/ppc64le-ipmi.stanza b/xCAT/templates/objects/node/ppc64le-ipmi.stanza index 706e6edf6..476b45dd8 100644 --- a/xCAT/templates/objects/node/ppc64le-ipmi.stanza +++ b/xCAT/templates/objects/node/ppc64le-ipmi.stanza @@ -4,12 +4,12 @@ ppc64le-template: objtype=node arch=ppc64le bmc="MANDATORY:The hostname or ip address of the BMC adapater" - bmcpassword="MANDATORY:the password of the BMC" - bmcusername="MANDATORY:the username of the BMC" + bmcpassword="OPTIONAL:the password of the BMC" + bmcusername="OPTIONAL:the username of the BMC" cons=ipmi groups=all ip="MANDATORY:the ip address of the node" - mac="MANDATORY:the mac of the node" + mac="OPTIONAL:the mac of the node" mgt=ipmi netboot=petitboot nodetype=mp diff --git a/xCAT/templates/objects/node/ppc64le-openbmc.stanza b/xCAT/templates/objects/node/ppc64le-openbmc.stanza index e4418f9a1..927331c0c 100644 --- a/xCAT/templates/objects/node/ppc64le-openbmc.stanza +++ b/xCAT/templates/objects/node/ppc64le-openbmc.stanza @@ -4,12 +4,12 @@ ppc64le-openbmc-template: objtype=node arch=ppc64le bmc="MANDATORY:The hostname or ip address of the BMC adapater" - bmcpassword="MANDATORY:the password of the BMC" - bmcusername="MANDATORY:the username of the BMC" + bmcpassword="OPTIONAL:the password of the BMC" + bmcusername="OPTIONAL:the username of the BMC" cons=openbmc groups=all ip="MANDATORY:the ip address of the node" - mac="MANDATORY:the mac of the node" + mac="OPTIONAL:the mac of the node" mgt=openbmc netboot=petitboot nodetype=mp diff --git a/xCAT/templates/objects/node/ppc64lekvmguest.stanza b/xCAT/templates/objects/node/ppc64lekvmguest.stanza index afa31e27e..2610d38b3 100644 --- a/xCAT/templates/objects/node/ppc64lekvmguest.stanza +++ b/xCAT/templates/objects/node/ppc64lekvmguest.stanza @@ -5,7 +5,7 @@ ppc64lekvmguest-template: arch=ppc64le groups=all ip="MANDATORY:the ip address of the kvm guest" - mac="MANDATORY:the mac of the kvm guest" + mac="OPTIONAL:the mac of the kvm guest" mgt=kvm netboot=grub2 vmcpus=2 diff --git a/xCAT/templates/objects/node/x86_64.stanza b/xCAT/templates/objects/node/x86_64.stanza index a2ad508d8..085ccc17e 100644 --- a/xCAT/templates/objects/node/x86_64.stanza +++ b/xCAT/templates/objects/node/x86_64.stanza @@ -4,14 +4,14 @@ x86_64-template: objtype=node arch=x86_64 bmc="MANDATORY:The hostname or ip address of the BMC adapater" - bmcpassword="MANDATORY:the password of the BMC" - bmcusername="MANDATORY:the username of the BMC" + bmcpassword="OPTIONAL:the password of the BMC" + bmcusername="OPTIONAL:the username of the BMC" cons=ipmi getmac=ipmi groups=all hcp= ip="MANDATORY:the ip address of the node" - mac="MANDATORY:the mac of the node" + mac="OPTIONAL:the mac of the node" mgt=ipmi netboot=xnba serialport=0 diff --git a/xCAT/templates/objects/node/x86_64kvmguest.stanza b/xCAT/templates/objects/node/x86_64kvmguest.stanza index 5b2329477..16494de27 100644 --- a/xCAT/templates/objects/node/x86_64kvmguest.stanza +++ b/xCAT/templates/objects/node/x86_64kvmguest.stanza @@ -5,7 +5,7 @@ x86_64kvmguest-template: arch=x86_64 groups=all ip="MANDATORY:the ip address of the kvm guest" - mac="MANDATORY:the mac of the kvm guest" + mac="OPTIONAL:the mac of the kvm guest" mgt=kvm netboot=xnba serialport=0 From ea81eb7d55c4239899c4f1d0231cfc37d0d41782 Mon Sep 17 00:00:00 2001 From: Gerd Pokorra Date: Tue, 22 Oct 2019 14:53:29 +0200 Subject: [PATCH 44/58] files to install CentOS 8 --- .../install/centos/compute.centos8.pkglist | 11 ++++ .../xcat/install/centos/compute.centos8.tmpl | 59 +++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 xCAT-server/share/xcat/install/centos/compute.centos8.pkglist create mode 100644 xCAT-server/share/xcat/install/centos/compute.centos8.tmpl diff --git a/xCAT-server/share/xcat/install/centos/compute.centos8.pkglist b/xCAT-server/share/xcat/install/centos/compute.centos8.pkglist new file mode 100644 index 000000000..0feb58550 --- /dev/null +++ b/xCAT-server/share/xcat/install/centos/compute.centos8.pkglist @@ -0,0 +1,11 @@ +@^minimal-environment +chrony +net-tools +nfs-utils +openssh-server +rsync +util-linux +wget +python3 +tar +bzip2 diff --git a/xCAT-server/share/xcat/install/centos/compute.centos8.tmpl b/xCAT-server/share/xcat/install/centos/compute.centos8.tmpl new file mode 100644 index 000000000..3719fd0c6 --- /dev/null +++ b/xCAT-server/share/xcat/install/centos/compute.centos8.tmpl @@ -0,0 +1,59 @@ +#version=CentOS8 +# Use text install +text +# Use network installation +%include /tmp/repos +# Keyboard layouts +keyboard --vckeymap=us --xlayouts='us' +# System language +lang en_US.UTF-8 + +# Network information +#KICKSTARTNET# +# Root password +rootpw --iscrypted #CRYPT:passwd:key=system,username=root:password# +# Not run the Setup Agent on first boot +firstboot --disable +# Do not configure the X Window System +skipx +# System services +#services --enabled="chronyd" +# System timezone +timezone #TABLE:site:key=timezone:value# --isUtc +# Partition clearing information +zerombr +clearpart --all --initlabel +#XCAT_PARTITION_START# +%include /tmp/partitionfile +#XCAT_PARTITION_END# + +# Do not configure any iptables rules +firewall --disable +selinux --disable +reboot + +%packages +#INCLUDE_DEFAULT_PKGLIST# + +%end + +%anaconda +pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --emptyok +pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok +pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --emptyok +%end +%pre +{ +echo "Running Kickstart Pre-installation script..." +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.rhels8# +} &>>/tmp/pre-install.log +%end +%post --interpreter=/bin/bash +mkdir -p /var/log/xcat/ +cat /tmp/pre-install.log >>/var/log/xcat/xcat.log +{ +echo "Running Kickstart Post-installation script..." +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.xcat.ng# +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.rhels8# +} &>>/var/log/xcat/xcat.log +%end From 2d706b9c75ec98900ab9214dd6f5ae72859b53e7 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 22 Oct 2019 11:51:23 -0400 Subject: [PATCH 45/58] bmcsetup Other LAN and 802.3 LAN for Channel Medium Type --- xCAT-genesis-scripts/usr/bin/bmcsetup | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xCAT-genesis-scripts/usr/bin/bmcsetup b/xCAT-genesis-scripts/usr/bin/bmcsetup index fa5955adb..15d5af578 100755 --- a/xCAT-genesis-scripts/usr/bin/bmcsetup +++ b/xCAT-genesis-scripts/usr/bin/bmcsetup @@ -271,14 +271,16 @@ fi LAN_MED_TYPE="802.3" if [ ! -z "$ISOPENBMC" ]; then - # Overvide the default value for OpenBMC - LAN_MED_TYPE="Other LAN" + # For OpenBMC, the value of "Channel Medium Type" attribute could be "Other LAN" for FW drivers prior to OP940.01 + # and "802.3" for FW drivers OP940.01 and later + LAN_MED_TYPE="802.3|Other LAN" fi +# Loop through channels and pick the one to communicate on while [ -z "$LANCHAN" ]; do logger -s -t $log_label -p local4.info "Auto detecting LAN channel..." for TLANCHAN in {1..16}; do # Try to get the channel information; then get the MAC which is used for the channel - if ipmitool channel info $TLANCHAN 2> /dev/null | grep "$LAN_MED_TYPE" > /dev/null 2>&1 && ipmitool raw 0xc 2 $TLANCHAN 5 0 0 > /dev/null 2>&1; then + if ipmitool channel info $TLANCHAN 2> /dev/null | grep -E "$LAN_MED_TYPE" > /dev/null 2>&1 && ipmitool raw 0xc 2 $TLANCHAN 5 0 0 > /dev/null 2>&1; then LANCHAN=$TLANCHAN break; fi; From 70d4be0cd06f198b4bb7bbf6c7e07f5697f9fcff Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 23 Oct 2019 15:45:25 -0400 Subject: [PATCH 46/58] Add regression test tabdump debug for service node not removed --- xCAT-test/autotest/bundle/rhels_ppc_daily.bundle | 4 ++++ xCAT-test/autotest/testcase/tabdump/cases0 | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/xCAT-test/autotest/bundle/rhels_ppc_daily.bundle b/xCAT-test/autotest/bundle/rhels_ppc_daily.bundle index 863a65c2d..1a68b4805 100644 --- a/xCAT-test/autotest/bundle/rhels_ppc_daily.bundle +++ b/xCAT-test/autotest/bundle/rhels_ppc_daily.bundle @@ -266,6 +266,7 @@ tabdump_w_lt tabdump_w_match tabdump_w_ne tabdump_w_notmatch +tabdump_servicenode tabgrep_err tabgrep_h tabgrep_node @@ -281,6 +282,7 @@ tabrestore_err tabrestore_h tabrestore_null tabrestore_table +tabdump_servicenode unregnotif_f unregnotif_h unregnotif_null @@ -290,6 +292,7 @@ xcatconfig_u_check_xcatsslversion_rhels_sles xcatd_restart xcatd_start xcatd_stop +tabdump_servicenode xcatstanzafile_attribute xcatstanzafile_colon xcatstanzafile_defaultvalue @@ -298,3 +301,4 @@ xcatstanzafile_normal xcatstanzafile_objtype xcatstanzafile_specificvalue xcatstanzafile_tab +tabdump_servicenode diff --git a/xCAT-test/autotest/testcase/tabdump/cases0 b/xCAT-test/autotest/testcase/tabdump/cases0 index a1f1a1127..33bfb8b1e 100644 --- a/xCAT-test/autotest/testcase/tabdump/cases0 +++ b/xCAT-test/autotest/testcase/tabdump/cases0 @@ -177,3 +177,9 @@ cmd:tabdump -d site | grep xcatiport check:rc==0 check:output=~xcatiport end + +start:tabdump_servicenode +label:mn_only,ci_test,db +cmd:tabdump servicenode +check:rc==0 +end From 6ef420b28f74a31ab581f88b0246669db320df15 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 23 Oct 2019 16:22:15 -0400 Subject: [PATCH 47/58] Add more calls to run tabdump servicenode --- .../autotest/bundle/rhels_ppc_daily.bundle | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/xCAT-test/autotest/bundle/rhels_ppc_daily.bundle b/xCAT-test/autotest/bundle/rhels_ppc_daily.bundle index 1a68b4805..86dcbb0ed 100644 --- a/xCAT-test/autotest/bundle/rhels_ppc_daily.bundle +++ b/xCAT-test/autotest/bundle/rhels_ppc_daily.bundle @@ -1,6 +1,9 @@ SN_setup_case +tabdump_servicenode reg_linux_diskless_installation_hierarchy +tabdump_servicenode reg_linux_diskfull_installation_hierarchy +tabdump_servicenode updatenode_P_script1 updatenode_P_script1_script2 updatenode_P_script2 @@ -22,6 +25,7 @@ updatenode_syncfile_MERGE updatenode_v updatenode_without_flag updatenode_without_options +tabdump_servicenode xdcp_nonroot_user xdcp_src_dst xdsh_E @@ -37,6 +41,7 @@ xdsh_permission_denied xdsh_q xdsh_regular_command xdsh_t +tabdump_servicenode assign_certain_command_permission chdef_dynamic_group chdef_group @@ -52,21 +57,25 @@ chdef_t_network chdef_t_node chdef_t_o_error chdef_z +tabdump_servicenode chtab_d chtab_h chtab_modify_key chtab_modify_node chtab_null chtab_v +tabdump_servicenode confignetwork_secondarynic_nicips_updatenode_false confignetwork_secondarynic_nicnetworks_updatenode_false confignetwork_secondarynic_nictype_updatenode_false +tabdump_servicenode copycds_a copycds_a_err copycds_iso copycds_n copycds_n_a copycds_n_err +tabdump_servicenode disable_root_permission_in_policy_table dumpxCATdb_a_p_nullskiptables dumpxCATdb_a_p_nullskiptables_V @@ -77,10 +86,12 @@ dumpxCATdb_p_nullskiptables dumpxCATdb_p_nullskiptables_V dumpxCATdb_p_skiptables dumpxCATdb_v +tabdump_servicenode encrypted_passwd_md5_diskfull encrypted_passwd_openssl_diskfull encrypted_passwd_sha256_diskfull encrypted_passwd_sha512_diskfull +tabdump_servicenode gettab_H gettab_err gettab_h @@ -88,6 +99,7 @@ gettab_key_table getmacs_d getmacs_f_D getmacs_noderange +tabdump_servicenode lsdef_a lsdef_null lsdef_t @@ -99,6 +111,7 @@ lsdef_t_w lslite_h lslite_i lslite_noderange +tabdump_servicenode lsxcatd_a lsxcatd_d lsxcatd_h @@ -108,11 +121,13 @@ makedhcp_a_d makedhcp_d makedhcp_n makedhcp_remote_network +tabdump_servicenode makedns makedns_d_node makedns_h makedns_n makedns_n_noderange +tabdump_servicenode makehost_n_r makehosts_d makehosts_h @@ -122,6 +137,7 @@ makehosts_n makehosts_n_noderange makehosts_null makeknownhosts_node_d +tabdump_servicenode makentp_h makentp_v mkdef_null @@ -132,12 +148,14 @@ mkdef_regex_nicsip mkdef_rhels73 mkdef_t_o_error mkdef_z +tabdump_servicenode nodeadd_err_symbol nodeadd_h nodeadd_noderange nodeadd_noderange_nodetype nodeadd_null nodeadd_v +tabdump_servicenode nodech_delete nodech_error_node nodech_error_table @@ -154,10 +172,12 @@ nodech_noderange_table_include nodech_noderange_table_unequal nodech_noderange_table_uninclude nodech_v +tabdump_servicenode nodegrpch_err nodegrpch_groups nodegrpch_h nodegrpch_v +tabdump_servicenode nodels_H nodels_S nodels_b @@ -178,6 +198,7 @@ nodels_table_include nodels_tablevalue nodels_tablevalue_tablecolumn nodels_v +tabdump_servicenode noderange_10-20 noderange_XCAT_NODE_PREFIX noderange_XCAT_NODE_SUFFIX @@ -191,6 +212,7 @@ noderm_err_node noderm_h noderm_noderange noderm_null +tabdump_servicenode nodeset_check_warninginfo nodeset_errorcommand nodeset_grub2 @@ -199,6 +221,7 @@ nodeset_yaboot nodeset_stat nodestat_err_node nodestat_usage +tabdump_servicenode packimage_h packimage_v pping_h @@ -219,11 +242,13 @@ regnotif_h regnotif_null regnotif_o regnotif_v +tabdump_servicenode restorexCAT_h restorexCATdb_a_p_V restorexCATdb_p_V restorexCATdb_v restorexCATdb_wrongpath +tabdump_servicenode rinv_all rinv_bus rinv_config @@ -233,6 +258,7 @@ rinv_serial rinv_noderange_err rmdef_null rmdef_t_err +tabdump_servicenode rpower_boot rpower_err_noderange rpower_noderange @@ -246,11 +272,14 @@ rscan_x rscan_x_w rscan_z rscan_z_w +tabdump_servicenode run_command_with_XCATBYPASS runcmdinstaller_h +tabdump_servicenode rvitals_all rvitals_lcds rvitals_noderange_err +tabdump_servicenode tabdump_d tabdump_d_nodehm tabdump_f_d From 616e2e4d12f0a2e375d8339af016285674e13b96 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 23 Oct 2019 17:24:31 -0400 Subject: [PATCH 48/58] Better message for Ubuntu uninstall --- xCAT-server/share/xcat/tools/go-xcat | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index dc402a8a8..ce35926e1 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.43 +# Version 1.0.44 # # Copyright (C) 2016 - 2019 International Business Machines # Eclipse Public License, Version 1.0 (EPL-1.0) @@ -25,6 +25,8 @@ # - Better debug log when reading repository failed # 2019-08-15 Mark Gurevich # - Added conserver-xcat to uninstall list +# 2019-10-23 Mark Gurevich +# - Display a list of packages that could not be uninstalled # function usage() @@ -173,7 +175,7 @@ GO_XCAT_INSTALL_LIST=(perl-xcat xcat xcat-buildkit xcat-client xcat-genesis-scripts-amd64 xcat-genesis-scripts-ppc64 xcat-server elilo-xcat grub2-xcat ipmitool-xcat syslinux-xcat xcat-genesis-base-amd64 xcat-genesis-base-ppc64 xnba-undi) -# The package list of all the packages should be installed +# The package list of all the packages should be uninstalled GO_XCAT_UNINSTALL_LIST=("${GO_XCAT_INSTALL_LIST[@]}" goconserver xCAT-SoftLayer xCAT-confluent xCAT-csm xCAT-genesis-builder xCAT-openbmc-py xCAT-probe xCAT-test xCAT-vlan xCATsn xCAT-UI-deps @@ -1576,6 +1578,7 @@ function remove_package_apt() local -a yes=() [[ "$1" = "-y" ]] && yes=("-y") && shift apt-get --allow-unauthenticated remove "${yes[@]}" "$@" + warn_if_bad "$?" "Unable to remove xCAT packages: "`apt --installed list 2>&1 | grep xcat | cut -d '/' -f 1` } function remove_package() @@ -1590,6 +1593,7 @@ function purge_package_apt() local -a yes=() [[ "$1" = "-y" ]] && yes=("-y") && shift apt-get --allow-unauthenticated purge "${yes[@]}" "$@" + warn_if_bad "$?" "Unable to purge xCAT packages: "`apt --installed list 2>&1 | grep xcat | cut -d '/' -f 1` } function purge_package_others() @@ -2092,22 +2096,17 @@ case "${GO_XCAT_ACTION}" in debug_logger <<-EOF - xCAT has been completely uninstalled! + xCAT has been uninstalled. + To install again - https://xcat.org/download.html EOF ;; "uninstall") debug_trace uninstall_xcat -y - boo_boo_if_bad "$?" debug_logger <<-EOF - xCAT has been uninstalled! - ========================== - - If you intend to install xCAT again, please follow the guideline on the - xcat.org website. - - https://xcat.org/download.html + xCAT has been uninstalled. + To install again - https://xcat.org/download.html EOF ;; esac From 58b670934c59ea7436c61723c7ed1e999926dfc0 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 24 Oct 2019 10:28:38 -0400 Subject: [PATCH 49/58] Doc fixes for osimage definition creation --- .../common/deployment/create_img.rst | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/common/deployment/create_img.rst b/docs/source/guides/admin-guides/manage_clusters/common/deployment/create_img.rst index cb60aa607..fcf2cafb4 100644 --- a/docs/source/guides/admin-guides/manage_clusters/common/deployment/create_img.rst +++ b/docs/source/guides/admin-guides/manage_clusters/common/deployment/create_img.rst @@ -1,15 +1,15 @@ Select or Create an osimage Definition ====================================== -Before creating an image on xCAT, the distro media should be prepared ahead. That can be ISOs or DVDs. +Before creating an image on xCAT, the distro media should be prepared. That can be ISOs or DVDs. -XCAT use 'copycds' command to create an image which will be available to install nodes. ``copycds`` will copy all contents of Distribution DVDs/ISOs or Service Pack DVDs/ISOs to a destination directory, and create several relevant osimage definitions by default. +XCAT uses ``copycds`` command to create an image which will be available to install nodes. ``copycds`` will copy all contents of Distribution DVDs/ISOs or Service Pack DVDs/ISOs to a destination directory, and create several relevant osimage definitions by default. If using an ISO, copy it to (or NFS mount it on) the management node, and then run: :: copycds /.iso -**Note**: while sle15 contains installer medium and packages medium, need ``copycds`` copy all contents of DVD1 of the installer medium and DVD1 of the packages medium, for example: :: +.. note:: While sle15 contains installer medium and packages medium, need ``copycds`` copy all contents of DVD1 of the installer medium and DVD1 of the packages medium, for example: :: copycds SLE-15-Installer-DVD-ppc64le-GM-DVD1.iso SLE-15-Packages-ppc64le-GM-DVD1.iso @@ -41,11 +41,11 @@ In these osimage definitions shown above * **--netboot-compute** is the default osimage definition used for diskless installation * **--install-service** is the default osimage definition used for service node deployment which shall be used in hierarchical environment -**Note**: There are more things needed for **ubuntu ppc64le** osimages: +.. note:: Additional steps are needed for **ubuntu ppc64le** osimages: -For pre-18.04 version of Ubuntu for ppc64el, the initrd.gz shipped with the ISO does not support network booting. In order to install ubuntu with xCAT, you need to follow the steps below to complete the osimage definition. +For pre-16.04.02 version of Ubuntu for ppc64el, the ``initrd.gz`` shipped with the ISO does not support network booting. In order to install Ubuntu with xCAT, you need to follow the steps to complete the osimage definition. -* Download mini.iso from +* Download ``mini.iso`` from [ubuntu 14.04.1]: http://xcat.org/files/netboot/ubuntu14.04.1/ppc64el/mini.iso @@ -59,7 +59,7 @@ For pre-18.04 version of Ubuntu for ppc64el, the initrd.gz shipped with the ISO [ubuntu 16.04.1]: http://xcat.org/files/netboot/ubuntu16.04.1/ppc64el/mini.iso -* Mount mini.iso :: +* Mount ``mini.iso`` :: mkdir /tmp/iso mount -o loop mini.iso /tmp/iso @@ -69,11 +69,9 @@ For pre-18.04 version of Ubuntu for ppc64el, the initrd.gz shipped with the ISO mkdir -p /install//ppc64el/install/netboot cp /tmp/iso/install/initrd.gz /install//ppc64el/install/netboot -**[Below tips maybe helpful for you]** - **[Tips 1]** -If this is the same distro version as what your management node uses, create a .repo file in /etc/yum.repos.d with contents similar to: :: +If this is the same distro version as what your management node uses, create a ``.repo`` file in ``/etc/yum.repos.d`` with contents similar to: :: [local--] name=xCAT local @@ -81,7 +79,7 @@ If this is the same distro version as what your management node uses, create a . enabled=1 gpgcheck=0 -In this way, if you need to install some additional RPMs into your MN later, you can simply install them with ``yum``. Or if you are installing a software on your MN that depends some RPMs from this disto, those RPMs will be found and installed automatically. +This way, if you need to install some additional RPMs into your MN later, you can simply install them with ``yum``. Or if you are installing a software on your MN that depends some RPMs from this disto, those RPMs will be found and installed automatically. **[Tips 2]** @@ -91,7 +89,7 @@ You can create/modify an osimage definition easily with any existing osimage def Except the specified attributes **, the attributes of ** will inherit the values of template osimage **. -As an example, the following command creates a new osimage "myosimage.rh7.compute.netboot" based on the existing osimage "rhels7.4-ppc64le-netboot-compute" with some customized attributes :: +As an example, the following command creates a new osimage ``myosimage.rh7.compute.netboot`` based on the existing osimage ``rhels7.4-ppc64le-netboot-compute`` with some customized attributes :: mkdef -t osimage -o myosimage.rh7.compute.netboot --template rhels7.4-ppc64le-netboot-compute synclists=/tmp/synclist otherpkgdir=/install/custom/osimage/myosimage.rh7.compute.netboot/3rdpkgs/ otherpkglist=/install/custom/osimage/myosimage.rh7.compute.netboot/3rd.pkglist From efc5f54c2b07ed66329cb28b81e4d5cac879e99a Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 24 Oct 2019 16:10:27 -0400 Subject: [PATCH 50/58] Add regression test tabdump debug for service node not removed 2 --- xCAT-test/autotest/bundle/rhels_ppc_daily.bundle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xCAT-test/autotest/bundle/rhels_ppc_daily.bundle b/xCAT-test/autotest/bundle/rhels_ppc_daily.bundle index 86dcbb0ed..39cd43183 100644 --- a/xCAT-test/autotest/bundle/rhels_ppc_daily.bundle +++ b/xCAT-test/autotest/bundle/rhels_ppc_daily.bundle @@ -266,10 +266,14 @@ rpower_noderange_nodeps rpower_off rpower_on rpower_stat +tabdump_servicenode rscan_noderange +tabdump_servicenode rscan_w +tabdump_servicenode rscan_x rscan_x_w +tabdump_servicenode rscan_z rscan_z_w tabdump_servicenode From 6c1b569c6a61c3e64296365c64841801626bc980 Mon Sep 17 00:00:00 2001 From: cxhong Date: Fri, 25 Oct 2019 10:21:44 -0400 Subject: [PATCH 51/58] add remove service node from servicenode table --- xCAT-test/autotest/testcase/rscan/cases0 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xCAT-test/autotest/testcase/rscan/cases0 b/xCAT-test/autotest/testcase/rscan/cases0 index 6f411c88b..98f09ae30 100644 --- a/xCAT-test/autotest/testcase/rscan/cases0 +++ b/xCAT-test/autotest/testcase/rscan/cases0 @@ -40,6 +40,7 @@ check:rc==0 check:output=~hcp=__GETNODEATTR($$CN,hcp)__ cmd:rmdef all cmd:cat /tmp/all.stanza | mkdef -z +cmd:chtab -d node=$$SN servicenode cmd:rm -f /tmp/all.stanza cmd:rm -f /tmp/$$CN.stanza end @@ -60,6 +61,7 @@ check:rc==0 check:output=~hcp=__GETNODEATTR($$CN,hcp)__ cmd:rmdef all cmd:cat /tmp/all.stanza | mkdef -z +cmd:chtab -d node=$$SN servicenode cmd:rm -f /tmp/all.stanza cmd:rm -f /tmp/$$CN.stanza end @@ -80,6 +82,7 @@ check:rc==0 check:output=~parent=[\w-]+ cmd:rmdef all cmd:cat /tmp/all.stanza | mkdef -z +cmd:chtab -d node=$$SN servicenode cmd:rm -f /tmp/all.stanza cmd:rm -f /tmp/$$CN.stanza end From d2ade80f29f28f5a187725abe42d9009a413bc9a Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 25 Oct 2019 10:42:14 -0400 Subject: [PATCH 52/58] Add display statement to genesis testcase script --- xCAT-test/autotest/testcase/genesis/test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-test/autotest/testcase/genesis/test.sh b/xCAT-test/autotest/testcase/genesis/test.sh index 83378c407..bdd174318 100755 --- a/xCAT-test/autotest/testcase/genesis/test.sh +++ b/xCAT-test/autotest/testcase/genesis/test.sh @@ -43,6 +43,7 @@ function check_destiny() { runcmd $cmd; cmd="makenetworks"; runcmd $cmd; + ip addr show makehosts ${TESTNODE} grep ${TESTNODE} /etc/hosts cmd="nodeset ${TESTNODE} shell"; From d034005e811be414909c3ab5b211500d20e2c6b6 Mon Sep 17 00:00:00 2001 From: cxhong Date: Mon, 28 Oct 2019 14:33:54 -0400 Subject: [PATCH 53/58] Error message if running kits on rhel8 --- xCAT-buildkit/bin/buildkit | 7 +++++++ xCAT-server/lib/xcat/plugins/kit.pm | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index eb119cde1..4842e47ed 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -344,6 +344,13 @@ if ($tempstring =~ /debian/ || $tempstring =~ /ubuntu/) { $debianflag = 1; } +my ($sysos, $sysver) = split /,/, $tempstring; +if ( ($sysos =~ /rh/) && ($sysver ge 8) ) { + print "ERROR: KITs are not supported on rhel8 or above\n"; + exit(1); +} + + # This is an undocumented flag to support our local build team # to allow building Ubuntu kits on our RH build machines. # It requires RH rpms such as dep, fakeroot, perl-File-DesktopEntry, diff --git a/xCAT-server/lib/xcat/plugins/kit.pm b/xCAT-server/lib/xcat/plugins/kit.pm index 2b1a0d6c4..d61cebbde 100644 --- a/xCAT-server/lib/xcat/plugins/kit.pm +++ b/xCAT-server/lib/xcat/plugins/kit.pm @@ -33,7 +33,7 @@ $::KITFRAMEWORK = "2"; $::COMPATIBLE_KITFRAMEWORKS = "0,1,2"; my $debianflag = 0; -my $tempstring = xCAT::Utils->osver(); +my $tempstring = xCAT::Utils->osver(all); if ($tempstring =~ /debian/ || $tempstring =~ /ubuntu/) { $debianflag = 1; @@ -99,6 +99,12 @@ sub process_request $::PID = $$; } + my ($sysos, $sysver) = split /,/, $tempstring; + if ( ($sysos =~ /rh/) && ($sysver ge 8) ) { + $callback->({ error => ["KITs are not supported on rhel8 or above"], errorcode => [1] }); + return 1; + } + my $command = $request->{command}->[0]; my $rc; From cb84cd87ac98add8f06d49e64ce7d29c14009a1f Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 30 Oct 2019 13:56:03 -0400 Subject: [PATCH 54/58] Restart libssl1.1 without asking when installing xCAT on Ubuntu for regression --- xCAT-test/autotest/testcase/install_xCAT/case0 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xCAT-test/autotest/testcase/install_xCAT/case0 b/xCAT-test/autotest/testcase/install_xCAT/case0 index 87b29595a..52041c0c5 100644 --- a/xCAT-test/autotest/testcase/install_xCAT/case0 +++ b/xCAT-test/autotest/testcase/install_xCAT/case0 @@ -31,6 +31,9 @@ stop:yes cmd:arc_all=`uname -a`; code=`lsb_release -sc`;if [[ $arc_all =~ "ppc64le" ]]; then arch="ppc64el";else arch="x86_64";fi; cp "/opt/xcat/share/xcat/tools/autotest/testcase/go_xcat/$code-$arch.sources.list" "/etc/apt/sources.list" cmd:apt-get clean;apt-get update check:rc==0 +cmd:echo '* libraries/restart-without-asking boolean true' | debconf-set-selections +check:rc==0 +cmd:debconf-show libssl1.1 cmd:cp /core-*-snap.tar.bz2 /install_xCAT_xcat-core.tar.bz2 check:rc==0 cmd:cp /xcat-dep*.tar.bz2 /install_xCAT_xcat-dep.tar.bz2 From e38731ca396671da88c0935dc2c2b839ee52b9ec Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 30 Oct 2019 14:08:19 -0400 Subject: [PATCH 55/58] Linmit to only x86 environment --- xCAT-test/autotest/testcase/install_xCAT/case0 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/install_xCAT/case0 b/xCAT-test/autotest/testcase/install_xCAT/case0 index 52041c0c5..35183600a 100644 --- a/xCAT-test/autotest/testcase/install_xCAT/case0 +++ b/xCAT-test/autotest/testcase/install_xCAT/case0 @@ -31,8 +31,7 @@ stop:yes cmd:arc_all=`uname -a`; code=`lsb_release -sc`;if [[ $arc_all =~ "ppc64le" ]]; then arch="ppc64el";else arch="x86_64";fi; cp "/opt/xcat/share/xcat/tools/autotest/testcase/go_xcat/$code-$arch.sources.list" "/etc/apt/sources.list" cmd:apt-get clean;apt-get update check:rc==0 -cmd:echo '* libraries/restart-without-asking boolean true' | debconf-set-selections -check:rc==0 +cmd:arc_all=`uname -a`; if [[ $arc_all =~ "x86_64" ]]; then echo '* libraries/restart-without-asking boolean true' | debconf-set-selections; fi cmd:debconf-show libssl1.1 cmd:cp /core-*-snap.tar.bz2 /install_xCAT_xcat-core.tar.bz2 check:rc==0 From f19604304b1e13dcfb2979e9f7081db7d4f3b910 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 1 Nov 2019 14:52:04 -0400 Subject: [PATCH 56/58] Fix formatting in postscritps doc --- .../deployment/prepostscripts/post_script.rst | 143 +++++++++--------- 1 file changed, 68 insertions(+), 75 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/common/deployment/prepostscripts/post_script.rst b/docs/source/guides/admin-guides/manage_clusters/common/deployment/prepostscripts/post_script.rst index f976329ec..277c96346 100644 --- a/docs/source/guides/admin-guides/manage_clusters/common/deployment/prepostscripts/post_script.rst +++ b/docs/source/guides/admin-guides/manage_clusters/common/deployment/prepostscripts/post_script.rst @@ -3,14 +3,14 @@ Using Postscript ---------------- -xCAT automatically runs a few postscripts and postbootscripts that are delivered with xCAT to set up the nodes. You can also add your own scripts to further customize the nodes. This explains the xCAT support to do this. +xCAT automatically runs a few postscripts and postbootscripts that are delivered with xCAT to set up the nodes. You can also add your own scripts to further customize the nodes. Types of scripts ~~~~~~~~~~~~~~~~ -There are two types of scripts in the postscripts table ( postscripts and postbootscripts). The types are based on when in the install process they will be executed. Run the following for more information: +There are two types of scripts in the postscripts table ( postscripts and postbootscripts). The types are based on when in the install process they will be executed. Run the following for more information:: - ``man postscripts`` + man postscripts * **postscripts attribute** - List of scripts that should be run on this node after diskful installation or diskless boot. @@ -20,17 +20,17 @@ There are two types of scripts in the postscripts table ( postscripts and postbo * **[SLES]** - Postscripts will be run after the reboot but before the init.d process. For Linux diskless deployment, the postscripts will be run at the init.d time, and xCAT will automatically add the list of postscripts from the postbootscripts attribute to run after postscripts list. + Postscripts will be run after the reboot but before the ``init.d`` process. For Linux diskless deployment, the postscripts will be run at the ``init.d`` time, and xCAT will automatically add the list of postscripts from the postbootscripts attribute to run after postscripts list. -* **postbootscripts attribute** - list of postbootscripts that should be run on this Linux node at the init.d time after diskful installation reboot or diskless boot -* **xCAT**, by default, for diskful installs only runs the postbootscripts on the install and not on reboot. In xCAT a site table attribute runbootscripts is available to change this default behavior. If set to yes, then the postbootscripts will be run on install and on reboot. +* **postbootscripts attribute** - list of postbootscripts that should be run on this Linux node at the ``init.d`` time after diskful installation reboot or diskless boot +* **xCAT**, by default, for diskful installs only runs the postbootscripts on the install and not on reboot. In xCAT a ``site`` table attribute ``runbootscripts`` is available to change this default behavior. If set to ``yes``, then the postbootscripts will be run on install and on reboot. -**xCAT automatically adds the postscripts from the xcatdefaults.postscripts attribute of the table to run first on the nodes after install or diskless boot.** +.. note:: xCAT automatically adds the postscripts from the xcatdefaults.postscripts attribute of the table to run first on the nodes after install or diskless boot. Adding your own postscripts ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -To add your own script, place it in /install/postscripts on the management node. Make sure it is executable and world readable. Then add it to the postscripts table for the group of nodes you want it to be run on (or the "all" group if you want it run on all nodes in the appropriate attribute, according to when you want it to run). +To add your own script, place it in ``/install/postscripts`` on the management node. Make sure it is executable and world readable. Then add it to the ``postscripts`` table for the group of nodes you want it to be run on (or the ``all`` group if you want it run on all nodes). To check what scripts will be run on your node during installation: :: @@ -42,11 +42,9 @@ You can pass parameters to the postscripts. For example: :: script1 p1 p2,script2,.... +``p1 p2`` are the parameters to ``script1``. - -p1 p2 are the parameters to script1. - -Postscripts could be placed in the subdirectories in /install/postscripts on management node, and specify "subdir/postscriptname" in the postscripts table to run the postscripts in the subdirectories. This feature could be used to categorize the postscripts for different purposes. Here is an example: :: +Postscripts could be placed in the subdirectories in ``/install/postscripts`` on management node, and specify ``subdir/postscriptname`` in the ``postscripts`` table to run the postscripts in the subdirectories. This feature could be used to categorize the postscripts for different purposes. For example: :: mkdir -p /install/postscripts/subdir1 mkdir -p /install/postscripts/subdir2 @@ -55,18 +53,15 @@ Postscripts could be placed in the subdirectories in /install/postscripts on man chdef node1 -p postscripts=subdir1/postscript1,subdir2/postscript2 updatenode node1 -P -If some of your postscripts will affect the network communication between the management node and compute node, like restarting network or configuring bond, the postscripts execution might not be able to be finished successfully because of the network connection problems, even if we put this postscript be the last postscript in the list, xCAT still may not be able to update the node status to be "booted". The recommendation is to use the Linux "at" mechanism to schedule this network-killing postscript to be run at a later time. Here is an example: +If some of your postscripts will affect the network communication between the management node and compute node, like restarting network or configuring bond, the postscripts execution might not be able to be finished successfully because of the network connection problems. Even if we put this postscript be the last postscript in the list, xCAT still may not be able to update the node status to be ``booted``. The recommendation is to use the Linux ``at`` mechanism to schedule this network-killing postscript to be run at a later time. For example: -The user needs to add a postscript to customize the nics bonding setup, the nics bonding setup will break the network between the management node and compute node, then we could use "at" to run this nic bonding postscripts after all the postscripts processes have been finished. +The user needs to add a postscript to customize the nics bonding setup, the nics bonding setup will break the network between the management node and compute node. User could use ``at`` to run this nic bonding postscripts after all the postscripts processes have been finished. -We could write a script, say, /install/postscripts/nicbondscript, the nicbondscript simply calls the confignicsbond using **"at"**: :: +Write a script, ``/install/postscripts/nicbondscript``, the ``nicbondscript`` simply calls the ``confignicsbond`` using ``at``: :: [root@xcatmn ~]#cat /install/postscripts/nicbondscript - #!/bin/bash - at -f ./confignicsbond now + 1 minute - [root@xcatmn ~]# Then :: @@ -77,23 +72,23 @@ Recommended Postscript design ''''''''''''''''''''''''''''' -* Postscripts that you want to run anywhere, Linux, should be written in shell. This should be available on all OS's. If only on the service nodes, you can use Perl . -* Postscripts should log errors using the following command **local4** is the default xCAT syslog class. **logger -t xCAT -p local4.info "your info message**". +* Postscripts that you want to run anywhere on Linux, should be written in shell. This should be available on all OS's. If only on the service nodes, you can use Perl . +* Postscripts should log errors using the following command (``local4`` is the default xCAT syslog class). ``logger -t xCAT -p local4.info "your info message"``. * Postscripts should have good and error exit codes (i.e 0 and 1). -* Postscripts should be well documented. At the top of the script, the first few lines should describe the function and inputs and output. You should have comments throughout the script. This is especially important if using regx. +* Postscripts should be well documented. At the top of the script, the first few lines should describe the function and inputs and output. You should have comments throughout the script. This is especially important if using ``regx``. PostScript/PostbootScript execution ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -When your script is executed on the node, all the attributes in the site table are exported as variables for your scripts to use. You can add extra attributes for yourself. See the sample mypostscript file below. +When your script is executed on the node, all the attributes in the ``site`` table are exported as variables for your scripts to use. You can add extra attributes for yourself. See the sample ``mypostscript`` file below. -To run the postscripts, a script is built, so the above exported variables can be input. You can usually find that script in /xcatpost on the node and for example in the Linux case it is call mypostscript. A good way to debug problems is to go to the node and just run mypostscript and see errors. You can also check the syslog on the Management Node for errors. +To run the postscripts, a script is built, so the above exported variables can be input. You can usually find that script in ``/xcatpost`` on the node and in the Linux case it is call ``mypostscript``. A good way to debug problems is to go to the node and just run ``mypostscript`` and see errors. You can also check the ``syslog`` on the Management Node for errors. -When writing you postscripts, it is good to follow the example of the current postscripts and write errors to syslog and in shell. See Suggestions for writing scripts. +When writing you postscripts, it is good to follow the example of the current postscripts and write errors to ``syslog`` and in shell. See Suggestions for writing scripts. -All attributes in the site table are exported and available to the postscript/postbootscript during execution. See the mypostscript file, which is generated and executed on the nodes to run the postscripts. +All attributes in the ``site`` table are exported and available to the postscript/postbootscript during execution. See the ``mypostscript`` file, which is generated and executed on the nodes to run the postscripts. -Example of mypostscript :: +Example of ``mypostscript`` :: #subroutine used to run postscripts run_ps () { @@ -216,7 +211,7 @@ Example of mypostscript :: run_ps script2 # postscripts-end-here\n -The mypostscript file is generated according to the mypostscript.tmpl file. +The ``mypostscript`` file is generated according to the ``mypostscript.tmpl`` file. .. _Using-the-mypostscript-template-label: @@ -226,38 +221,40 @@ Using the mypostscript template Using the mypostscript template ''''''''''''''''''''''''''''''' -xCAT provides a way for the admin to customize the information that will be provided to the postscripts/postbootscripts when they run on the node. This is done by editing the mypostscript.tmpl file. The attributes that are provided in the shipped mypostscript.tmpl file should not be removed. They are needed by the default xCAT postscripts. +xCAT provides a way for the admin to customize the information that will be provided to the postscripts/postbootscripts when they run on the node. This is done by editing the ``mypostscript.tmpl`` file. The attributes that are provided in the shipped ``mypostscript.tmpl`` file should not be removed. They are needed by the default xCAT postscripts. -The mypostscript.tmpl, is shipped in the /opt/xcat/share/xcat/mypostscript directory. +The ``mypostscript.tmpl``, is shipped in the ``/opt/xcat/share/xcat/mypostscript`` directory. -If the admin customizes the mypostscript.tmpl, they should copy the mypostscript.tmpl to /install/postscripts/mypostscript.tmpl, and then edit it. The mypostscript for each node will be named mypostscript.. The generated mypostscript.. will be put in the /tftpboot/mypostscripts directory. +If the admin customizes the ``mypostscript.tmpl``, they should copy the ``mypostscript.tmpl`` to ``/install/postscripts/mypostscript.tmpl``, and then edit it. The ``mypostscript`` for each node will be named ``mypostscript.``. The generated ``mypostscript.``. will be put in the ``/tftpboot/mypostscripts directory``. site table precreatemypostscripts attribute ''''''''''''''''''''''''''''''''''''''''''' -If the site table precreatemypostscripts attribute is set to 1 or yes, it will instruct xCAT at nodeset and updatenode time to query the db once for all of the nodes passed into the command and create the mypostscript file for each node and put them in a directory in $TFTPDIR(for example /tftpboot). The created mypostscript.. file in the /tftpboot/mypostscripts directory will not be regenerated unless another nodeset or updatenode command is run to that node. This should be used when the system definition has stabilized. It saves time on the updatenode or reboot by not regenerating the mypostscript file. +If the site table ``precreatemypostscripts`` attribute is set to ``1`` or ``yes``, it will instruct xCAT at ``nodeset`` and ``updatenode`` time to query the db once for all of the nodes passed into the command and create the ``mypostscript`` file for each node and put them in a directory in ``$TFTPDIR`` (for example ``/tftpboot``). The created ``mypostscript.``. file in the ``/tftpboot/mypostscripts`` directory will not be regenerated unless another ``nodeset`` or ``updatenode`` command is run to that node. This should be used when the system definition has stabilized. It saves time on the ``updatenode`` or reboot by not regenerating the ``mypostscript`` file. -If the precreatemyposcripts attribute is yes, and a database change is made or xCAT code is upgraded, then you should run a new nodeset or updatenode to regenerate the /tftpboot/mypostscript/mypostscript.. file to pick up the latest database setting. The default for precreatemypostscripts is no/0. +If the ``precreatemyposcripts`` attribute is ``yes``, and a database change is made or xCAT code is upgraded, then you should run a new ``nodeset`` or ``updatenode`` to regenerate the ``/tftpboot/mypostscript/mypostscript.`` file to pick up the latest database setting. The default for ``precreatemypostscripts`` is ``no/0``. -When you run nodeset or updatenode, it will search the **/install/postscripts/mypostscript.tmpl** first. If the **/install/postscripts/mypostscript.tmpl** exists, it will use that template to generate the mypostscript for each node. Otherwise, it will use **/opt/xcat/share/xcat/mypostscript/mypostscript.tmpl**. +When you run ``nodeset`` or ``updatenode``, it will search the ``/install/postscripts/mypostscript.tmpl`` first. If the ``/install/postscripts/mypostscript.tmpl`` exists, it will use that template to generate the ``mypostscript`` for each node. Otherwise, it will use ``/opt/xcat/share/xcat/mypostscript/mypostscript.tmpl``. Content of the template for mypostscript '''''''''''''''''''''''''''''''''''''''' -**The attributes that are defined in the shipped mypostscript.tmpl file** should not be removed. The xCAT default postscripts rely on that information to run successfully. **The following will explain the entries in the mypostscript.tmpl file**. +.. note:: The attributes that are defined in the shipped mypostscript.tmpl file should not be removed. The xCAT default postscripts rely on that information to run successfully. -The SITE_TABLE_ALL_ATTRIBS_EXPORT line in the file directs the code to export all attributes defined in the site table. -Note: the attributes are not always defined exactly as in the site table to avoid conflict with other table attributes of the same name. For example, the site table master attribute is named SITEMASTER in the generated mypostscript file. :: +The following will explain the entries in the ``mypostscript.tmpl`` file. + +The ``SITE_TABLE_ALL_ATTRIBS_EXPORT`` line in the file directs the code to export all attributes defined in the ``site`` table. +The attributes are not always defined exactly as in the ``site`` table to avoid conflict with other table attributes of the same name. For example, the site table master attribute is named SITEMASTER in the generated mypostscript file. :: #SITE_TABLE_ALL_ATTRIBS_EXPORT# -The following line exports ENABLESSHBETWEENNODES by running the internal xCAT routine (enablesshbetweennodes). :: +The following line exports ``ENABLESSHBETWEENNODES`` by running the internal xCAT routine (``enablesshbetweennodes``). :: ENABLESSHBETWEENNODES=#Subroutine:xCAT::Template::enablesshbetweennodes:$NODE# export ENABLESSHBETWEENNODES -**tabdump()** is used to get all the information in the **** table :: +``tabdump()`` is used to get all the information in the ```` table :: tabdump(networks) @@ -271,7 +268,7 @@ These lines get a comma separated list of the groups to which the node belongs. GROUP=#TABLE:nodelist:$NODE:groups# export GROUP -These lines reads the nodesres table, the given attributes (nfsserver,installnic,primarynic,xcatmaster,routenames) for the node **($NODE)**, and exports it. :: +These lines reads the ``nodesres`` table, the given attributes (``nfsserver``, ``installnic``, ``primarynic``, ``xcatmaster``, ``routenames``) for the node ``($NODE)``, and exports it. :: NFSSERVER=#TABLE:noderes:$NODE:nfsserver# export NFSSERVER @@ -284,11 +281,11 @@ These lines reads the nodesres table, the given attributes (nfsserver,installnic NODEROUTENAMES=#TABLE:noderes:$NODE:routenames# export NODEROUTENAMES -The following entry exports multiple variables from the routes table. Not always set. :: +The following entry exports multiple variables from the ``routes`` table. Not always set. :: #ROUTES_VARS_EXPORT# -The following lines export nodetype table attributes. :: +The following lines export ``nodetype`` table attributes. :: OSVER=#TABLE:nodetype:$NODE:os# export OSVER @@ -304,17 +301,17 @@ The following adds the current directory to the path for the postscripts. :: PATH=`dirname $0`:$PATH export PATH -The following sets the NODESETSTATE by running the internal xCAT getnodesetstate script. :: +The following sets the ``NODESETSTATE`` by running the internal xCAT ``getnodesetstate`` script. :: NODESETSTATE=#Subroutine:xCAT::Postage::getnodesetstate:$NODE# export NODESETSTATE -The following says the postscripts are not being run as a result of updatenode.(This is changed =1, when updatenode runs). :: +The following says the postscripts are not being run as a result of ``updatenode``. (This is changed ``=1``, when ``updatenode`` runs). :: UPDATENODE=0 export UPDATENODE -The following sets the NTYPE to compute,service or MN. :: +The following sets the ``NTYPE`` to compute, service or MN. :: NTYPE=$NTYPE export NTYPE @@ -324,7 +321,7 @@ The following sets the mac address. :: MACADDRESS=#TABLE:mac:$NODE:mac# export MACADDRESS -If vlan is setup, then the #VLAN_VARS_EXPORT# line will provide the following exports: :: +If vlan is setup, then the ``#VLAN_VARS_EXPORT#`` line will provide the following exports: :: VMNODE='YES' export VMNODE @@ -334,7 +331,7 @@ If vlan is setup, then the #VLAN_VARS_EXPORT# line will provide the following ex .. #VLAN_VARS_EXPORT# -If monitoring is setup, then the #MONITORING_VARS_EXPORT# line will provide: :: +If monitoring is setup, then the ``#MONITORING_VARS_EXPORT#`` line will provide: :: MONSERVER=11.10.34.108 export MONSERVER @@ -342,7 +339,7 @@ If monitoring is setup, then the #MONITORING_VARS_EXPORT# line will provide: :: export MONMASTER #MONITORING_VARS_EXPORT# -The OSIMAGE_VARS_EXPORT# line will provide, for example: :: +The ``#OSIMAGE_VARS_EXPORT#`` line will provide, for example: :: OSPKGDIR=/install// export OSPKGDIR @@ -352,7 +349,7 @@ The OSIMAGE_VARS_EXPORT# line will provide, for example: :: #OSIMAGE_VARS_EXPORT# -THE NETWORK_FOR_DISKLESS_EXPORT# line will provide diskless networks information, if defined. :: +THE ``#NETWORK_FOR_DISKLESS_EXPORT#`` line will provide diskless networks information, if defined. :: NETMASK=255.255.255.0 export NETMASK @@ -361,9 +358,9 @@ THE NETWORK_FOR_DISKLESS_EXPORT# line will provide diskless networks information .. #NETWORK_FOR_DISKLESS_EXPORT# -Note: the **#INCLUDE_POSTSCRIPTS_LIST#** and the **#INCLUDE_POSTBOOTSCRIPTS_LIST#** sections in **/tftpboot/mypostscript(mypostbootscripts)** on the Management Node will contain all the postscripts and postbootscripts defined for the node. When running an **updatenode** command for only some of the scripts , you will see in the **/xcatpost/mypostscript** file on the node, the list has been redefined during the execution of updatenode to only run the requested scripts. For example, if you run **updatenode -P** syslog. +Note: the ``#INCLUDE_POSTSCRIPTS_LIST#`` and the ``#INCLUDE_POSTBOOTSCRIPTS_LIST#`` sections in ``/tftpboot/mypostscript(mypostbootscripts)`` on the Management Node will contain all the postscripts and postbootscripts defined for the node. When running an ``updatenode`` command for only some of the scripts , you will see in the ``/xcatpost/mypostscript`` file on the node, the list has been redefined during the execution of ``updatenode`` to only run the requested scripts. For example, if you run ``updatenode -P syslog``. -The **#INCLUDE_POSTSCRIPTS_LIST#** flag provides a list of postscripts defined for this **$NODE**. :: +The ``#INCLUDE_POSTSCRIPTS_LIST#`` flag provides a list of postscripts defined for this ``$NODE``. :: #INCLUDE_POSTSCRIPTS_LIST# @@ -378,7 +375,7 @@ For example, you will see in the generated file the following stanzas: :: syncfiles # node-postscripts-end-here -The **#INCLUDE_POSTBOOTSCRIPTS_LIST#** provides a list of postbootscripts defined for this **$NODE**. :: +The ``#INCLUDE_POSTBOOTSCRIPTS_LIST#`` provides a list of postbootscripts defined for this ``$NODE``. :: #INCLUDE_POSTBOOTSCRIPTS_LIST# @@ -394,7 +391,7 @@ For example, you will see in the generated file the following stanzas: :: Kinds of variables in the template ''''''''''''''''''''''''''''''''''' -**Type 1:** For the simple variable, the syntax is as follows. The mypostscript.tmpl has several examples of this. **$NODE** is filled in by the code. **UPDATENODE** is changed to 1, when the postscripts are run by ``updatenode``. **$NTYPE** is filled in as either compute,service or MN. :: +**Type 1:** For the simple variable, the syntax is as follows. The ``mypostscript.tmpl`` has several examples of this. ``$NODE`` is filled in by the code. ``UPDATENODE`` is changed to 1, when the postscripts are run by ``updatenode``. ``$NTYPE`` is filled in as either ``compute``, ``service`` or ``MN``. :: NODE=$NODE export NODE @@ -403,11 +400,11 @@ Kinds of variables in the template NTYPE=$NTYPE export NTYPE -**Type 2:** This is the syntax to get the value of one attribute from the **** and its key is **$NODE**. It does not support tables with two keys. Some of the tables with two keys are **(litefile,prodkey,deps,monsetting,mpa,networks)**. :: +**Type 2:** This is the syntax to get the value of one attribute from the ```` and its key is ``$NODE``. It does not support tables with two keys. Some of the tables with two keys are ``litefile``, ``prodkey``, ``deps``, ``monsetting``, ``mpa``, ``networks``. :: VARNAME=#TABLE:tablename:$NODE:attribute# -For example, to get the new updatestatus attribute from the nodelist table: :: +For example, to get the new ``updatestatus`` attribute from the ``nodelist`` table: :: UPDATESTATUS=#TABLE:nodelist:$NODE:updatestatus# export UPDATESTATUS @@ -418,20 +415,20 @@ For example, to get the new updatestatus attribute from the nodelist table: :: or VARNAME=#Subroutine:modulename::subroutinename# -Examples in the mypostscript.tmpl are the following: :: +Examples in the ``mypostscript.tmpl`` are the following: :: NODESETSTATE=#Subroutine:xCAT::Postage::getnodesetstate:$NODE# export NODESETSTATE ENABLESSHBETWEENNODES=#Subroutine:xCAT::Template::enablesshbetweennodes:$NODE# export ENABLESSHBETWEENNODES -Note: Type 3 is not an open interface to add extensions to the template. +.. note:: Type 3 is not an open interface to add extensions to the template. -**Type 4:** The syntax is #FLAG#. When parsing the template, the code generates all entries defined by **#FLAG#**, if they are defined in the database. For example: To export all values of all attributes from the site table. The tag is :: +**Type 4:** The syntax is ``#FLAG#``. When parsing the template, the code generates all entries defined by ``#FLAG#``, if they are defined in the database. For example: To export all values of all attributes from the ``site`` table. The tag is :: #SITE_TABLE_ALL_ATTRIBS_EXPORT# -For the **#SITE_TABLE_ALL_ATTRIBS_EXPORT#** flag, the related subroutine will get the attributes' values and deal with the special case. such as : the site.master should be exported as **"SITEMASTER"**. And if the noderes.xcatmaster exists, the noderes.xcatmaster should be exported as **"MASTER"**, otherwise, we also should export site.master as the **"MASTER"**. +For the ``#SITE_TABLE_ALL_ATTRIBS_EXPORT#`` flag, the related subroutine will get the attributes' values and deal with the special case. such as : the ``site.master`` should be exported as ``"SITEMASTER"``. And if the ``noderes.xcatmaster`` exists, the ``noderes.xcatmaster`` should be exported as ``"MASTER"``, otherwise, we also should export ``site.master`` as the ``"MASTER"``. Other examples are: :: @@ -442,11 +439,9 @@ Other examples are: :: #INCLUDE_POSTSCRIPTS_LIST# - includes the list of all postscripts for the node #INCLUDE_POSTBOOTSCRIPTS_LIST# - includes the list of all postbootscripts for the node -Note: Type4 is not an open interface to add extensions to the templatel. +.. note:: Type4 is not an open interface to add extensions to the template. -**Type 5:** Get all the data from the specified table. The **** should not be a node table, like nodelist. This should be handles with TYPE 2 syntax to get specific attributes for the **$NODE**. tabdump would result in too much data for a nodetype table. Also the auditlog, eventlog should not be in tabdump for the same reason. site table should not be specified, it is already provided with the **#SITE_TABLE_ALL_ATTRIBS_EXPORT#** flag. It can be used to get the data from the two key tables (like switch). :: - - The syntax is: +**Type 5:** Get all the data from the specified table. The ```` should not be a node table, like ``nodelist``. This should be handles with TYPE 2 syntax to get specific attributes for the ``$NODE``. ``tabdump`` would result in too much data for a ``nodetype`` table. Also the ``auditlog``, ``eventlog`` should not be in ``tabdump`` for the same reason. ``site`` table should not be specified, it is already provided with the ``#SITE_TABLE_ALL_ATTRIBS_EXPORT#`` flag. It can be used to get the data from the two key tables (like ``switch``). The syntax is: :: tabdump() @@ -455,7 +450,7 @@ Edit mypostscript.tmpl **Add new attributes into mypostscript.tmpl** -When you add new attributes into the template, you should edit the **/install/postscripts/mypostscript.tmpl** which you created by copying **/opt/xcat/share/xcat/mypostscript/mypostscript.tmpl**. Make all additions before the **# postscripts-start-here** section. xCAT will first look in **/install/postscripts/mypostscript.tmpl** for a file and then if not found will use the one in **/opt/xcat/share/xcat/mypostcript/mypostscript.tmpl**. +When you add new attributes into the template, you should edit the ``/install/postscripts/mypostscript.tmpl`` which you created by copying ``/opt/xcat/share/xcat/mypostscript/mypostscript.tmpl``. Make all additions before the ``# postscripts-start-here`` section. xCAT will first look in ``/install/postscripts/mypostscript.tmpl`` for a file and then, if not found, will use the one in ``/opt/xcat/share/xcat/mypostcript/mypostscript.tmpl``. For example: :: @@ -467,11 +462,11 @@ For example: :: ## The following flag postscripts-end-here must not be deleted. # postscripts-end-here -Note: If you have a hierarchical cluster, you must copy your new mypostscript.tmpl to **/install/postscripts/mypostscript.tmpl** on the service nodes, unless **/install/postscripts** directory is mounted from the MN to the service node. +.. note:: If you have a hierarchical cluster, you must copy your new ``mypostscript.tmpl`` to ``/install/postscripts/mypostscript.tmpl`` on the service nodes, unless ``/install/postscripts`` directory is mounted from the MN to the service node. **Remove attribute from mypostscript.tmpl** -If you want to remove an attribute that you have added, you should remove all the related lines or comment them out with ##. For example, comment out the added lines. :: +If you want to remove an attribute that you have added, you should remove all the related lines or comment them out with ``##``. For example, comment out the added lines. :: ##UPDATESTATUS=#TABLE:nodelist:$NODE:updatestatus# ##export UPDATESTATUS @@ -481,32 +476,30 @@ Test the new template There are two quick ways to test the template. -#. -If the node is up: :: +1. If the node is up :: - updatenode -P syslog + updatenode -P syslog -Check your generated template : :: + Check your generated ``mypostscript`` on the compute node: :: - Check the generated mypostscript file on compute node /xcatpost. + vi /xcatpost/mypostscript -#. -Another way, is set the precreate option :: +2. Set the ``precreatemypostscripts`` option :: chdef -t site -o clustersite precreatemypostscripts=1 -Then run :: + Then run :: nodeset .... -Check your generated template :: + Check your generated ``mypostscript`` :: vi /tftpboot/mypostscripts/mypostscript. Sample /xcatpost/mypostscript ''''''''''''''''''''''''''''''' -This is an example of the generated postscript for a servicenode install. It is found in /xcatpost/mypostscript on the node. :: +This is an example of the generated postscript for a servicenode install. It is found in ``/xcatpost/mypostscript`` on the node. :: # global value to store the running status of the postbootscripts,the value #is non-zero if one postbootscript failed From 51759927ec3cc5fd2c5acbd3ee28966f470216a2 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 4 Nov 2019 13:11:56 -0500 Subject: [PATCH 57/58] Restart libssl1.1 without asking for regression Ubuntu pkg install --- xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm index 0eb9c3b8d..f272d7354 100644 --- a/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm +++ b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm @@ -43,6 +43,7 @@ cmd:xdsh $$CN "apt-get clean all" check:rc==0 cmd:xdsh $$CN "apt-get update" check:rc==0 +cmd:arc_all=`uname -a`; if [[ $arc_all =~ "x86_64" ]]; then xdsh $$CN "echo '* libraries/restart-without-asking boolean true' | debconf-set-selections"; fi cmd:xdsh $$CN "apt-get -y install build-essential dpkg-dev dh-make debhelper fakeroot gnupg lintian pbuilder quilt reprepro libsoap-lite-perl libdbi-perl" check:rc==0 cmd:xdsh $$CN "rm -rf /oldxcat" From 2f4f5d4057b0554f0585a8329edb9de10c647d67 Mon Sep 17 00:00:00 2001 From: cxhong Date: Mon, 4 Nov 2019 14:51:59 -0500 Subject: [PATCH 58/58] link packlist from rh to centos --- .../share/xcat/netboot/centos/compute.centos8.ppc64le.exlist | 1 + .../share/xcat/netboot/centos/compute.centos8.ppc64le.pkglist | 1 + .../xcat/netboot/centos/compute.centos8.ppc64le.postinstall | 1 + .../share/xcat/netboot/centos/compute.centos8.x86_64.exlist | 1 + .../share/xcat/netboot/centos/compute.centos8.x86_64.pkglist | 1 + .../share/xcat/netboot/centos/compute.centos8.x86_64.postinstall | 1 + 6 files changed, 6 insertions(+) create mode 120000 xCAT-server/share/xcat/netboot/centos/compute.centos8.ppc64le.exlist create mode 120000 xCAT-server/share/xcat/netboot/centos/compute.centos8.ppc64le.pkglist create mode 120000 xCAT-server/share/xcat/netboot/centos/compute.centos8.ppc64le.postinstall create mode 120000 xCAT-server/share/xcat/netboot/centos/compute.centos8.x86_64.exlist create mode 120000 xCAT-server/share/xcat/netboot/centos/compute.centos8.x86_64.pkglist create mode 120000 xCAT-server/share/xcat/netboot/centos/compute.centos8.x86_64.postinstall diff --git a/xCAT-server/share/xcat/netboot/centos/compute.centos8.ppc64le.exlist b/xCAT-server/share/xcat/netboot/centos/compute.centos8.ppc64le.exlist new file mode 120000 index 000000000..f468ba7e1 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/centos/compute.centos8.ppc64le.exlist @@ -0,0 +1 @@ +../rh/compute.rhels8.ppc64le.exlist \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/centos/compute.centos8.ppc64le.pkglist b/xCAT-server/share/xcat/netboot/centos/compute.centos8.ppc64le.pkglist new file mode 120000 index 000000000..38195cc33 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/centos/compute.centos8.ppc64le.pkglist @@ -0,0 +1 @@ +../rh/compute.rhels8.ppc64le.pkglist \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/centos/compute.centos8.ppc64le.postinstall b/xCAT-server/share/xcat/netboot/centos/compute.centos8.ppc64le.postinstall new file mode 120000 index 000000000..011158f7b --- /dev/null +++ b/xCAT-server/share/xcat/netboot/centos/compute.centos8.ppc64le.postinstall @@ -0,0 +1 @@ +../rh/compute.rhels8.ppc64le.postinstall \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/centos/compute.centos8.x86_64.exlist b/xCAT-server/share/xcat/netboot/centos/compute.centos8.x86_64.exlist new file mode 120000 index 000000000..a6d9c0135 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/centos/compute.centos8.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/centos/compute.centos8.x86_64.pkglist b/xCAT-server/share/xcat/netboot/centos/compute.centos8.x86_64.pkglist new file mode 120000 index 000000000..5ecd4c4d1 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/centos/compute.centos8.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/centos/compute.centos8.x86_64.postinstall b/xCAT-server/share/xcat/netboot/centos/compute.centos8.x86_64.postinstall new file mode 120000 index 000000000..3e16d254e --- /dev/null +++ b/xCAT-server/share/xcat/netboot/centos/compute.centos8.x86_64.postinstall @@ -0,0 +1 @@ +../rh/compute.rhels8.x86_64.postinstall \ No newline at end of file