From 2ca5f8852312180c3589f990a884285db29679c0 Mon Sep 17 00:00:00 2001 From: AngelaBriel Date: Fri, 1 Nov 2024 10:28:02 +0100 Subject: [PATCH 01/12] support '--force-color' for saptune_check too, calling it unbuffered --- main.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 8294067..ffbc911 100644 --- a/main.go +++ b/main.go @@ -170,8 +170,14 @@ func callSaptuneCheckScript(arg string) { cmdOut, err = exec.Command(saptcheck, "--json").CombinedOutput() system.Jcollect(cmdOut) } else { - // call external scrip saptune_check - cmd := exec.Command(saptcheck) + var cmd *exec.Cmd + // call external script saptune_check + if system.IsFlagSet("force-color") { + // call saptune_check unbuffered + cmd = exec.Command("unbuffer", saptcheck) + } else { + cmd = exec.Command(saptcheck) + } cmd.Stdin = os.Stdin cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr From 9eec7c3d6163d55785c700ecde1ea35e4988a9c7 Mon Sep 17 00:00:00 2001 From: AngelaBriel Date: Mon, 4 Nov 2024 15:09:35 +0100 Subject: [PATCH 02/12] Houskeeping of SAP Notes - update version and date change link location to the new 'me.sap.com' location add/change parameter for some notes (bsc#1232212) --- ospackage/usr/share/saptune/notes/1410736 | 2 +- ospackage/usr/share/saptune/notes/1557506 | 2 +- ospackage/usr/share/saptune/notes/1656250 | 6 ++--- ospackage/usr/share/saptune/notes/1680803 | 10 +++---- ospackage/usr/share/saptune/notes/1771258 | 2 +- ospackage/usr/share/saptune/notes/1805750 | 6 ++--- ospackage/usr/share/saptune/notes/1868829 | 2 +- ospackage/usr/share/saptune/notes/1980196 | 2 +- ospackage/usr/share/saptune/notes/1984787 | 2 +- ospackage/usr/share/saptune/notes/2161991 | 2 +- ospackage/usr/share/saptune/notes/2205917 | 2 +- ospackage/usr/share/saptune/notes/2382421 | 33 +++++++++++++---------- ospackage/usr/share/saptune/notes/2534844 | 2 +- ospackage/usr/share/saptune/notes/2578899 | 12 +++++---- ospackage/usr/share/saptune/notes/2684254 | 18 +++++++++++-- ospackage/usr/share/saptune/notes/2993054 | 6 ++--- ospackage/usr/share/saptune/notes/3024346 | 10 +++---- ospackage/usr/share/saptune/notes/900929 | 2 +- ospackage/usr/share/saptune/notes/941735 | 2 +- 19 files changed, 69 insertions(+), 54 deletions(-) diff --git a/ospackage/usr/share/saptune/notes/1410736 b/ospackage/usr/share/saptune/notes/1410736 index 7d7d39f..8273d80 100644 --- a/ospackage/usr/share/saptune/notes/1410736 +++ b/ospackage/usr/share/saptune/notes/1410736 @@ -5,7 +5,7 @@ VERSION=6 DATE=15.06.2020 DESCRIPTION=TCP/IP: setting keepalive interval -REFERENCES=https://launchpad.support.sap.com/#/notes/1410736 +REFERENCES=https://me.sap.com/notes/1410736 [sysctl] net.ipv4.tcp_keepalive_time = 300 diff --git a/ospackage/usr/share/saptune/notes/1557506 b/ospackage/usr/share/saptune/notes/1557506 index 9e62a3d..4deeee5 100644 --- a/ospackage/usr/share/saptune/notes/1557506 +++ b/ospackage/usr/share/saptune/notes/1557506 @@ -5,7 +5,7 @@ VERSION=16 DATE=06.02.2020 DESCRIPTION=Linux paging improvements -REFERENCES=https://launchpad.support.sap.com/#/notes/1557506 +REFERENCES=https://me.sap.com/notes/1557506 [pagecache] ## Type: yesno diff --git a/ospackage/usr/share/saptune/notes/1656250 b/ospackage/usr/share/saptune/notes/1656250 index 94191ca..bc92418 100644 --- a/ospackage/usr/share/saptune/notes/1656250 +++ b/ospackage/usr/share/saptune/notes/1656250 @@ -1,10 +1,10 @@ # 1656250 - SAP on AWS: Support prerequisites - only Linux Operating System IO Recommendations [version] -VERSION=63 -DATE=05.02.2024 +VERSION=69 +DATE=10.10.2024 DESCRIPTION=SAP on AWS: Support prerequisites - only Linux Operating System IO Recommendations -REFERENCES=https://launchpad.support.sap.com/#/notes/1656250 +REFERENCES=https://me.sap.com/notes/1656250 [sys:blkpat=nvme:csp=aws] # On linux operating systems the kernel parameter nvme_core.io_timeout controls diff --git a/ospackage/usr/share/saptune/notes/1680803 b/ospackage/usr/share/saptune/notes/1680803 index 6b358ea..fad1810 100644 --- a/ospackage/usr/share/saptune/notes/1680803 +++ b/ospackage/usr/share/saptune/notes/1680803 @@ -3,22 +3,20 @@ # # as described in the current online version of the best practice document # 'Best Practice for SAP Business Suite and SAP BW' linked in the -# 'Solution' section of the related SAP Note 1680803 on SAP launchpad +# 'Solution' section of the related SAP Note 1680803 at SAP (me.sap.com) # # chapter Operating System Configuration - Prerequisites # # SAP Applications on SAP Adaptive Server Enterprise # - Best Practices for Migration and Runtime -# -# SAP ASE (Sybase) -# Version 28 from 26.10.2023 in English +# v3.2 2023-09-20 # [version] VERSION=28 DATE=26.10.2023 DESCRIPTION=Sybase - SAP Adaptive Server Enterprise -REFERENCES=https://launchpad.support.sap.com/#/notes/1680803 +REFERENCES=https://me.sap.com/notes/1680803 [sysctl] # Set the keepalive interval to a value higher than 1200 seconds. @@ -29,5 +27,3 @@ net.ipv4.tcp_keepalive_time = 1250 [sysctl:csp=azure] net.ipv4.tcp_keepalive_time = - -[reminder] diff --git a/ospackage/usr/share/saptune/notes/1771258 b/ospackage/usr/share/saptune/notes/1771258 index a1fb50b..18dfe9a 100644 --- a/ospackage/usr/share/saptune/notes/1771258 +++ b/ospackage/usr/share/saptune/notes/1771258 @@ -7,7 +7,7 @@ VERSION=8 DATE=05.01.2023 DESCRIPTION=Linux: User and system resource limits -REFERENCES=https://launchpad.support.sap.com/#/notes/1771258 +REFERENCES=https://me.sap.com/notes/1771258 [limits] # /etc/security/limits.conf or drop-in file in /etc/securitty/limits.d diff --git a/ospackage/usr/share/saptune/notes/1805750 b/ospackage/usr/share/saptune/notes/1805750 index 442097f..65cb5a7 100644 --- a/ospackage/usr/share/saptune/notes/1805750 +++ b/ospackage/usr/share/saptune/notes/1805750 @@ -3,10 +3,10 @@ # [version] -VERSION=9 -DATE=10.03.2020 +VERSION=10 +DATE=21.05.2024 DESCRIPTION=SYB: Usage of HugePages on Linux Systems with Sybase ASE -REFERENCES=https://launchpad.support.sap.com/#/notes/1805750 +REFERENCES=https://me.sap.com/notes/1805750 [limits] # Allow Sybase ASE owner to make use of available HugePages. diff --git a/ospackage/usr/share/saptune/notes/1868829 b/ospackage/usr/share/saptune/notes/1868829 index 022ec9d..b980fbc 100644 --- a/ospackage/usr/share/saptune/notes/1868829 +++ b/ospackage/usr/share/saptune/notes/1868829 @@ -4,7 +4,7 @@ VERSION=5 DATE=29.03.2018 DESCRIPTION=Startup Issues Because Number of Active I/O Requests to Queue Exceeds aio-max-nr Limit -REFERENCES=https://launchpad.support.sap.com/#/notes/1868829 +REFERENCES=https://me.sap.com/notes/1868829 [sysctl] # maximum number of asynchronous I/Os. diff --git a/ospackage/usr/share/saptune/notes/1980196 b/ospackage/usr/share/saptune/notes/1980196 index 8c1652f..84cb947 100644 --- a/ospackage/usr/share/saptune/notes/1980196 +++ b/ospackage/usr/share/saptune/notes/1980196 @@ -4,7 +4,7 @@ VERSION=7 DATE=18.10.2017 DESCRIPTION=Setting Linux Kernel Parameter /proc/sys/vm/max_map_count on SAP HANA Systems -REFERENCES=https://launchpad.support.sap.com/#/notes/1980196 +REFERENCES=https://me.sap.com/notes/1980196 [sysctl] # vm.max_map_count diff --git a/ospackage/usr/share/saptune/notes/1984787 b/ospackage/usr/share/saptune/notes/1984787 index 56e0391..365fe95 100644 --- a/ospackage/usr/share/saptune/notes/1984787 +++ b/ospackage/usr/share/saptune/notes/1984787 @@ -5,7 +5,7 @@ VERSION=42 DATE=07.10.2022 DESCRIPTION=SUSE LINUX Enterprise Server 12: Installation notes -REFERENCES=https://launchpad.support.sap.com/#/notes/1984787 +REFERENCES=https://me.sap.com/notes/1984787 [login] # /etc/systemd/logind.conf.d/saptune-UserTasksMax.conf UserTasksMax setting diff --git a/ospackage/usr/share/saptune/notes/2161991 b/ospackage/usr/share/saptune/notes/2161991 index 8a4d727..d7bfa02 100644 --- a/ospackage/usr/share/saptune/notes/2161991 +++ b/ospackage/usr/share/saptune/notes/2161991 @@ -5,7 +5,7 @@ VERSION=28 DATE=29.07.2021 DESCRIPTION=VMware vSphere configuration guidelines -REFERENCES=https://launchpad.support.sap.com/#/notes/2161991 +REFERENCES=https://me.sap.com/notes/2161991 [block] ## Type: string diff --git a/ospackage/usr/share/saptune/notes/2205917 b/ospackage/usr/share/saptune/notes/2205917 index b8d27b5..058afc5 100644 --- a/ospackage/usr/share/saptune/notes/2205917 +++ b/ospackage/usr/share/saptune/notes/2205917 @@ -5,7 +5,7 @@ VERSION=63 DATE=18.05.2021 DESCRIPTION=SAP HANA DB: Recommended OS settings for SLES 12 / SLES for SAP Applications 12 -REFERENCES=https://launchpad.support.sap.com/#/notes/2205917 +REFERENCES=https://me.sap.com/notes/2205917 [login] # /etc/systemd/logind.conf.d/saptune-UserTasksMax.conf UserTasksMax setting diff --git a/ospackage/usr/share/saptune/notes/2382421 b/ospackage/usr/share/saptune/notes/2382421 index d441752..c422476 100644 --- a/ospackage/usr/share/saptune/notes/2382421 +++ b/ospackage/usr/share/saptune/notes/2382421 @@ -1,23 +1,12 @@ # 2382421 - Optimizing the Network Configuration on HANA- and OS-Level [version] -VERSION=45 -DATE=02.08.2023 +VERSION=47 +DATE=12.03.2024 DESCRIPTION=Optimizing the Network Configuration on HANA- and OS-Level -REFERENCES=https://launchpad.support.sap.com/#/notes/2382421 +REFERENCES=https://me.sap.com/notes/2382421 [sysctl] -# This parameter limits the size of the accept backlog of a listening socket. -# The Linux default of 128 is not sufficient. You need to set the parameter -# to 4096 in order that the HANA system can use higher values. -# There is an interdependency between this parameter and HANA configuration -# parameter tcp_backlog. If net.core.somaxconn is set to a lower value than -# tcp_backlog, tcp_backlog will be silently truncated to the value set for -# net.core.somaxconn. Therefore, you need to ensure that net.core.somaxconn -# is always set to a value equal to or greater than tcp_backlog. -# net.core.somaxconn >= 4096 -net.core.somaxconn = 4096 - # This is the size of the SYN backlog. # To prevent the kernel from using SYN cookies in a situation where lots of # connection requests are sent in a short timeframe and to prevent a @@ -157,6 +146,22 @@ net.ipv4.tcp_tw_reuse = # 8, which translates into a timeout of 190 seconds. net.ipv4.tcp_syn_retries = 8 +[sysctl:os=15-SP3] +# This parameter limits the size of the accept backlog of a listening socket. +# The Linux default of 128 is not sufficient. You need to set the parameter +# to 4096 in order that the HANA system can use higher values. +# There is an interdependency between this parameter and HANA configuration +# parameter tcp_backlog. If net.core.somaxconn is set to a lower value than +# tcp_backlog, tcp_backlog will be silently truncated to the value set for +# net.core.somaxconn. Therefore, you need to ensure that net.core.somaxconn +# is always set to a value equal to or greater than tcp_backlog. +# net.core.somaxconn >= 4096 +net.core.somaxconn = 4096 +[sysctl:os=15-SP2] +net.core.somaxconn = 4096 +[sysctl:os=15-SP1] +net.core.somaxconn = 4096 + [sysctl:os=12-SP3] # net.ipv4.tcp_tw_recycle # This parameter reduces the time a connection spends in the TIME_WAIT state. diff --git a/ospackage/usr/share/saptune/notes/2534844 b/ospackage/usr/share/saptune/notes/2534844 index eecac0b..4dcabc2 100644 --- a/ospackage/usr/share/saptune/notes/2534844 +++ b/ospackage/usr/share/saptune/notes/2534844 @@ -4,7 +4,7 @@ VERSION=15 DATE=26.05.2023 DESCRIPTION=Indexserver Crash During Startup due to Insufficient Shared Memory Segment -REFERENCES=https://launchpad.support.sap.com/#/notes/2534844 +REFERENCES=https://me.sap.com/notes/2534844 [sysctl] # kernel.shmmni diff --git a/ospackage/usr/share/saptune/notes/2578899 b/ospackage/usr/share/saptune/notes/2578899 index 71cae3a..774f067 100644 --- a/ospackage/usr/share/saptune/notes/2578899 +++ b/ospackage/usr/share/saptune/notes/2578899 @@ -2,10 +2,10 @@ # Description: You want to use SAP software on SUSE Linux Enterprise Server 15 (SLES 15) or SUSE Linux Enterprise Server 15 for SAP Applications (SLES for SAP 15). [version] -VERSION=48 -DATE=28.06.2024 +VERSION=50 +DATE=07.10.2024 DESCRIPTION=SUSE Linux Enterprise Server 15: Installation Note -REFERENCES=https://launchpad.support.sap.com/#/notes/2578899 +REFERENCES=https://me.sap.com/notes/2578899 [service] # start the related services @@ -14,12 +14,12 @@ sysstat.service=start [service:os=15-SP4] sysctl-logger.service=start - [service:os=15-SP5] sysctl-logger.service=start - [service:os=15-SP6] sysctl-logger.service=start +[service:os=15-SP7] +sysctl-logger.service=start [block] # The default I/O scheduler for single-queued block layer devices offers @@ -56,6 +56,8 @@ binutils 15 2.35.1-6.20.1 binutils 15-SP1 2.35.1-7.18.1 binutils 15-SP2 2.35.1-7.18.1 uuidd 15-SP3 2.36.2-150300.4.17.1 +polkit 0.114-1.12 +insserv-compat 0.1-2.15 [rpm:os=15-SP3:arch=x86_64] glibc 2.31-150300.46.1 diff --git a/ospackage/usr/share/saptune/notes/2684254 b/ospackage/usr/share/saptune/notes/2684254 index ac2c1a1..0f58382 100644 --- a/ospackage/usr/share/saptune/notes/2684254 +++ b/ospackage/usr/share/saptune/notes/2684254 @@ -2,10 +2,10 @@ # Description: HANA DB settings [version] -VERSION=23 +VERSION=24 DATE=03.05.2023 DESCRIPTION=SAP HANA DB: Recommended OS settings for SLES 15 / SLES for SAP Applications 15 -REFERENCES=https://launchpad.support.sap.com/#/notes/2684254 +REFERENCES=https://me.sap.com/notes/2684254 [vm] # Disable transparent hugepages (THP) @@ -25,6 +25,20 @@ THP=never # KSM=0 +[vm:os=15-SP5] +# Enable transparent hugepages (THP) +# changes /sys/kernel/mm/transparent_hugepage/enabled +# 'never' to disable, 'always' to enable +# 'madvise' will enter direct reclaim like 'always' but only for regions that +# are have used madvise(MADV_HUGEPAGE). This is the default behaviour. +# SAP Note 2131662, 2031375 +# +THP=madvise +[vm:os=15-SP6] +THP=madvise +[vm:os=15-SP7] +THP=madvise + [cpu:arch=x86_64] # Energy Performance Bias EPB (applies to Intel-based systems only) # energy_perf_bias: performance - 0, normal - 6, powersave - 15 diff --git a/ospackage/usr/share/saptune/notes/2993054 b/ospackage/usr/share/saptune/notes/2993054 index 83b2fd6..4044c53 100644 --- a/ospackage/usr/share/saptune/notes/2993054 +++ b/ospackage/usr/share/saptune/notes/2993054 @@ -2,10 +2,10 @@ # Description: Azure settings [version] -VERSION=2 -DATE=13.07.2021 +VERSION=3 +DATE=06.08.2024 DESCRIPTION=Recommended settings for SAP systems on Linux running in Azure virtual machines -REFERENCES=https://launchpad.support.sap.com/#/notes/2993054 +REFERENCES=https://me.sap.com/notes/2993054 [sysctl:csp=azure] net.ipv4.tcp_keepalive_time = 300 diff --git a/ospackage/usr/share/saptune/notes/3024346 b/ospackage/usr/share/saptune/notes/3024346 index ae96806..7e87310 100644 --- a/ospackage/usr/share/saptune/notes/3024346 +++ b/ospackage/usr/share/saptune/notes/3024346 @@ -2,10 +2,10 @@ # See TR-4290 (FAS) or TR-4435 (AFF). [version] -VERSION=10 -DATE=09.02.2024 +VERSION=12 +DATE=20.09.2024 DESCRIPTION=Linux Kernel Settings for NetApp NFS -REFERENCES=https://launchpad.support.sap.com/#/notes/3024346 https://docs.netapp.com/us-en/netapp-solutions-sap/bp/saphana-fas-nfs_introduction.html https://docs.netapp.com/us-en/netapp-solutions-sap/bp/saphana_aff_nfs_introduction.html +REFERENCES=https://me.sap.com/notes/3024346 https://docs.netapp.com/us-en/netapp-solutions-sap/bp/saphana-fas-nfs_introduction.html https://docs.netapp.com/us-en/netapp-solutions-sap/bp/saphana_aff_nfs_introduction.html [sysctl] net.core.rmem_max = 16777216 @@ -19,7 +19,5 @@ net.ipv4.tcp_moderate_rcvbuf = 1 net.ipv4.tcp_window_scaling = 1 net.ipv4.tcp_timestamps = 1 net.ipv4.tcp_sack = 1 +sunrpc.tcp_max_slot_table_entries = 128 -[reminder] -# NFS version 3 requires to limit the max TCP Slot Table entries. -# Therefore add "options sunrpc tcp_max_slot_table_entries=128" into file "/etc/modprobe.d/sunrpc.conf". diff --git a/ospackage/usr/share/saptune/notes/900929 b/ospackage/usr/share/saptune/notes/900929 index 9462288..a92408c 100644 --- a/ospackage/usr/share/saptune/notes/900929 +++ b/ospackage/usr/share/saptune/notes/900929 @@ -4,7 +4,7 @@ VERSION=7 DATE=31.07.2017 DESCRIPTION=Linux: STORAGE_PARAMETERS_WRONG_SET and 'mmap() failed' -REFERENCES=https://launchpad.support.sap.com/#/notes/900929 +REFERENCES=https://me.sap.com/notes/900929 [sysctl] # vm.max_map_count diff --git a/ospackage/usr/share/saptune/notes/941735 b/ospackage/usr/share/saptune/notes/941735 index 7595e0d..b853403 100644 --- a/ospackage/usr/share/saptune/notes/941735 +++ b/ospackage/usr/share/saptune/notes/941735 @@ -5,7 +5,7 @@ VERSION=11 DATE=04.05.2018 DESCRIPTION=SAP memory management system for 64-bit Linux systems -REFERENCES=https://launchpad.support.sap.com/#/notes/941735 +REFERENCES=https://me.sap.com/notes/941735 [mem] # /dev/shm From b1498690c84cd1059aad24486c76f708b617306d Mon Sep 17 00:00:00 2001 From: AngelaBriel Date: Mon, 4 Nov 2024 16:23:41 +0100 Subject: [PATCH 03/12] change SAP note link reference for unittests too. --- actions/actionsMatchtxt_test.go | 2 +- actions/noteacts_test.go | 2 +- sap/note/note_test.go | 2 +- testdata/etc/saptune/extra/900929.conf | 2 +- testdata/extra/900929.conf | 2 +- txtparser/ini_test.go | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/actions/actionsMatchtxt_test.go b/actions/actionsMatchtxt_test.go index 7d46137..9a7e5c5 100644 --- a/actions/actionsMatchtxt_test.go +++ b/actions/actionsMatchtxt_test.go @@ -9,7 +9,7 @@ var noteListMatchText = ` All notes (+ denotes manually enabled notes, * denotes notes enabled by solutions, - denotes notes enabled by solutions but reverted manually later, O denotes override file exists for note, C denotes custom note): 900929 Linux: STORAGE_PARAMETERS_WRONG_SET and 'mmap() failed' Version 7 from 31.07.2017 - https://launchpad.support.sap.com/#/notes/900929 + https://me.sap.com/notes/900929 NEWSOL2NOTE extraNote Configuration drop in for extra tests Version 0 from 04.06.2019 diff --git a/actions/noteacts_test.go b/actions/noteacts_test.go index ebd6133..056125b 100644 --- a/actions/noteacts_test.go +++ b/actions/noteacts_test.go @@ -39,7 +39,7 @@ func TestNoteActions(t *testing.T) { All notes (+ denotes manually enabled notes, * denotes notes enabled by solutions, - denotes notes enabled by solutions but reverted manually later, O denotes override file exists for note, C denotes custom note): C 900929 Linux: STORAGE_PARAMETERS_WRONG_SET and 'mmap() failed' Version 7 from 31.07.2017 - https://launchpad.support.sap.com/#/notes/900929 + https://me.sap.com/notes/900929 + NEWSOL2NOTE  - O extraNote Configuration drop in for extra tests Version 0 from 04.06.2019 diff --git a/sap/note/note_test.go b/sap/note/note_test.go index e6c48bb..06c2120 100644 --- a/sap/note/note_test.go +++ b/sap/note/note_test.go @@ -297,7 +297,7 @@ func TestGetNoteHeadData(t *testing.T) { tstDesc := "Linux: STORAGE_PARAMETERS_WRONG_SET and 'mmap() failed'" tstVers := "7" tstDate := "31.07.2017" - tstRef := "https://launchpad.support.sap.com/#/notes/900929" + tstRef := "https://me.sap.com/notes/900929" noteDesc, noteVers, noteRdate, noteRefs := GetNoteHeadData(tstNote) if noteDesc != tstDesc { t.Errorf("got: %+v, expected: %+v\n", noteDesc, tstDesc) diff --git a/testdata/etc/saptune/extra/900929.conf b/testdata/etc/saptune/extra/900929.conf index babdbc5..5b49673 100644 --- a/testdata/etc/saptune/extra/900929.conf +++ b/testdata/etc/saptune/extra/900929.conf @@ -5,7 +5,7 @@ VERSION=7 DATE=31.07.2017 DESCRIPTION=Linux: STORAGE_PARAMETERS_WRONG_SET and 'mmap() failed' -REFERENCES=https://launchpad.support.sap.com/#/notes/900929 +REFERENCES=https://me.sap.com/notes/900929 [sysctl] # vm.max_map_count diff --git a/testdata/extra/900929.conf b/testdata/extra/900929.conf index babdbc5..5b49673 100644 --- a/testdata/extra/900929.conf +++ b/testdata/extra/900929.conf @@ -5,7 +5,7 @@ VERSION=7 DATE=31.07.2017 DESCRIPTION=Linux: STORAGE_PARAMETERS_WRONG_SET and 'mmap() failed' -REFERENCES=https://launchpad.support.sap.com/#/notes/900929 +REFERENCES=https://me.sap.com/notes/900929 [sysctl] # vm.max_map_count diff --git a/txtparser/ini_test.go b/txtparser/ini_test.go index 4e07012..2950907 100644 --- a/txtparser/ini_test.go +++ b/txtparser/ini_test.go @@ -17,12 +17,12 @@ var fileNameNew = path.Join(os.Getenv("GOPATH"), "/src/github.com/SUSE/saptune/t var fileNameWrong = path.Join(os.Getenv("GOPATH"), "/src/github.com/SUSE/saptune/testdata/ini_wrong_test.ini") var fileNameMissing = path.Join(os.Getenv("GOPATH"), "/src/github.com/SUSE/saptune/testdata/ini_missing_test.ini") var fileName = path.Join(os.Getenv("GOPATH"), "/src/github.com/SUSE/saptune/ospackage/usr/share/saptune/notes/1557506") -var descName = fmt.Sprintf("%s\n\t\t\t%sVersion %s from %s\n\t\t\t%s", "Linux paging improvements", "", "16", "06.02.2020", "https://launchpad.support.sap.com/#/notes/1557506") +var descName = fmt.Sprintf("%s\n\t\t\t%sVersion %s from %s\n\t\t\t%s", "Linux paging improvements", "", "16", "06.02.2020", "https://me.sap.com/notes/1557506") var descNameNew = fmt.Sprintf("%s\n\t\t\t%sVersion %s from %s", "Linux paging improvements", "", "16", "06.02.2020") var noteVersion = "16" var noteDate = "06.02.2020" var noteTitle = "Linux paging improvements" -var noteRefs = "https://launchpad.support.sap.com/#/notes/1557506" +var noteRefs = "https://me.sap.com/notes/1557506" var oldDescName = fmt.Sprintf("%s\n\t\t\t%sVersion %s from %s", "ini_test: SAP Note file for ini_test", "", "2", "02.11.2017") var oldNoteVersion = "2" var oldNoteDate = "02.11.2017" From 4449144cb960c02ddadbc714cbaa386f826287c5 Mon Sep 17 00:00:00 2001 From: AngelaBriel Date: Mon, 4 Nov 2024 18:02:52 +0100 Subject: [PATCH 04/12] fix docker command in development.md beautify daemon log entries --- development.md | 4 ++-- system/daemon.go | 50 ++++++++++++++++++++++++------------------------ 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/development.md b/development.md index 23d2ac1..4e0cc2c 100644 --- a/development.md +++ b/development.md @@ -23,12 +23,12 @@ and run the unit tests (in a docker container) ## unit tests for saptune: after committing the changes to git travis is used for automatic testing -But before committing the sources, run the tests locally by using docker and the same workflow as on travis +But before committing the sources, run the tests locally by using docker and the same workflow as with github actions su - systemctl start docker cd $GOPATH/src/github.com/SUSE/saptune - docker run --name saptune-ci --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro -td -v "$(pwd):/app" registry.opensuse.org/home/angelabriel/st-ci-base/containers/st-ci-base + docker run --name saptune-ci --privileged --tmpfs /run -v /sys/fs/cgroup:/sys/fs/cgroup:rw --cgroupns=host -td -v "$(pwd):/app" registry.opensuse.org/home/angelabriel/st-ci-base/containers/st-ci-base docker exec -t saptune-ci /bin/sh -c "cd /app; ./run_saptune_ci_tst.sh;" in $GOPATH/src/github.com/SUSE/saptune diff --git a/system/daemon.go b/system/daemon.go index a4d4d4b..46b78c7 100644 --- a/system/daemon.go +++ b/system/daemon.go @@ -2,7 +2,7 @@ package system import ( "fmt" - "os" + "io/ioutil" "os/exec" "regexp" "strings" @@ -17,9 +17,9 @@ var actTunedProfile = "/etc/tuned/active_profile" func SystemctlEnable(thing string) error { out, err := exec.Command(systemctlCmd, "enable", thing).CombinedOutput() if err != nil { - return ErrorLog("%v - Failed to call systemctl enable on %s - %s", err, thing, string(out)) + return ErrorLog("%v - Failed to call systemctl enable on %s - %s", err, thing, strings.TrimSpace(string(out))) } - DebugLog("SystemctlEnable - /usr/bin/systemctl enable '%s' : '%+v %s'", thing, err, string(out)) + DebugLog("SystemctlEnable - /usr/bin/systemctl enable '%s' : '%+v %s'", thing, err, strings.TrimSpace(string(out))) return nil } @@ -27,9 +27,9 @@ func SystemctlEnable(thing string) error { func SystemctlStatus(thing string) error { out, err := exec.Command(systemctlCmd, "status", thing).CombinedOutput() if err != nil { - return ErrorLog("%v - Failed to call systemctl status on %s - %s", err, thing, string(out)) + return ErrorLog("%v - Failed to call systemctl status on %s - %s", err, thing, strings.TrimSpace(string(out))) } - NoticeLog("SystemctlStatus - '%+v'\n", string(out)) + NoticeLog("SystemctlStatus - '%+v'\n", strings.TrimSpace(string(out))) return nil } @@ -37,9 +37,9 @@ func SystemctlStatus(thing string) error { func SystemctlDisable(thing string) error { out, err := exec.Command(systemctlCmd, "disable", thing).CombinedOutput() if err != nil { - return ErrorLog("%v - Failed to call systemctl disable on %s - %s", err, thing, string(out)) + return ErrorLog("%v - Failed to call systemctl disable on %s - %s", err, thing, strings.TrimSpace(string(out))) } - DebugLog("SystemctlDisable - /usr/bin/systemctl disable '%s' : '%+v %s'", thing, err, string(out)) + DebugLog("SystemctlDisable - /usr/bin/systemctl disable '%s' : '%+v %s'", thing, err, strings.TrimSpace(string(out))) return nil } @@ -57,16 +57,16 @@ func SystemdDetectVirt(opt string) (bool, string, error) { } else { out, err = exec.Command(systemddvCmd, opt).CombinedOutput() } - DebugLog("SystemdDetectVirt - /usr/bin/systemd-detect-virt %s : '%+v %s'", opt, err, string(out)) + DebugLog("SystemdDetectVirt - /usr/bin/systemd-detect-virt %s : '%+v %s'", opt, err, strings.TrimSpace(string(out))) if err == nil { // virtualized environment detected virt = true } if len(out) == 0 && err != nil && opt != "-r" { - return virt, vtype, ErrorLog("%v - Failed to call systemd-detect-virt %s - %s", err, opt, string(out)) + return virt, vtype, ErrorLog("%v - Failed to call systemd-detect-virt %s - %s", err, opt, strings.TrimSpace(string(out))) } - vtype = string(out) - return virt, strings.TrimSpace(vtype), err + vtype = strings.TrimSpace(string(out)) + return virt, vtype, err } // execSystemctlCmd will execute /usr/bin/systemctl with the requested command @@ -78,9 +78,9 @@ func execSystemctlCmd(service, cmd string) error { if running { out, err := exec.Command(systemctlCmd, cmd, service).CombinedOutput() if err != nil { - return ErrorLog("%v - Failed to call systemctl %s on %s - %s", err, cmd, service, string(out)) + return ErrorLog("%v - Failed to call systemctl %s on %s - %s", err, cmd, service, strings.TrimSpace(string(out))) } - DebugLog("execSystemctlCmd, called from '%v' - /usr/bin/systemctl %s '%s' : '%+v %s'", CalledFrom(), cmd, service, err, string(out)) + DebugLog("execSystemctlCmd, called from '%v' - /usr/bin/systemctl %s '%s' : '%+v %s'", CalledFrom(), cmd, service, err, strings.TrimSpace(string(out))) } return nil } @@ -114,9 +114,9 @@ func SystemctlResetFailed() error { if running { out, err := exec.Command(systemctlCmd, "reset-failed").CombinedOutput() if err != nil { - return ErrorLog("%v - Failed to call systemctl reset-failed - %s", err, string(out)) + return ErrorLog("%v - Failed to call systemctl reset-failed - %s", err, strings.TrimSpace(string(out))) } - DebugLog("SystemctlResetFailed - /usr/bin/systemctl reset-failed : '%+v %s'", err, string(out)) + DebugLog("SystemctlResetFailed - /usr/bin/systemctl reset-failed : '%+v %s'", err, strings.TrimSpace(string(out))) } return nil } @@ -144,7 +144,7 @@ func SystemctlDisableStop(thing string) error { func checkSystemctlState(service, cmd string) (bool, error) { match := false out, err := exec.Command(systemctlCmd, cmd, service).CombinedOutput() - DebugLog("checkSystemctlState, called from '%v' - /usr/bin/systemctl %s %s: '%+v %s'", CalledFrom(), cmd, service, err, string(out)) + DebugLog("checkSystemctlState, called from '%v' - /usr/bin/systemctl %s %s: '%+v %s'", CalledFrom(), cmd, service, err, strings.TrimSpace(string(out))) if err == nil { match = true } @@ -171,7 +171,7 @@ func SystemctlIsRunning(thing string) (bool, error) { func SystemctlIsStarting() bool { match := false out, err := exec.Command(systemctlCmd, "is-system-running").CombinedOutput() - DebugLog("SystemctlIsStarting - /usr/bin/systemctl is-system-running : '%+v %s'", err, string(out)) + DebugLog("SystemctlIsStarting - /usr/bin/systemctl is-system-running : '%+v %s'", err, strings.TrimSpace(string(out))) if strings.TrimSpace(string(out)) == "starting" { DebugLog("SystemctlIsStarting - system is in state 'starting'") match = true @@ -182,7 +182,7 @@ func SystemctlIsStarting() bool { // SystemctlIsActive returns the output of 'systemctl is-active' func SystemctlIsActive(thing string) (string, error) { out, err := exec.Command(systemctlCmd, "is-active", thing).CombinedOutput() - DebugLog("SystemctlIsActive - /usr/bin/systemctl is-active : '%+v %s'", err, string(out)) + DebugLog("SystemctlIsActive - /usr/bin/systemctl is-active : '%+v %s'", err, strings.TrimSpace(string(out))) if len(out) == 0 && err != nil { return "", ErrorLog("%v - Failed to call systemctl is-active", err) } @@ -193,7 +193,7 @@ func SystemctlIsActive(thing string) (string, error) { func GetSystemState() (string, error) { retval := "" out, err := exec.Command(systemctlCmd, "is-system-running").CombinedOutput() - DebugLog("GetSystemState - /usr/bin/systemctl is-system-running : '%+v %s'", err, string(out)) + DebugLog("GetSystemState - /usr/bin/systemctl is-system-running : '%+v %s'", err, strings.TrimSpace(string(out))) if len(out) != 0 { retval = strings.TrimSpace(string(out)) } @@ -207,7 +207,7 @@ func GetSystemState() (string, error) { func IsSystemRunning() (bool, error) { match := false out, err := exec.Command(systemctlCmd, "is-system-running").CombinedOutput() - DebugLog("IsSystemRunning - /usr/bin/systemctl is-system-running : '%+v %s'", err, string(out)) + DebugLog("IsSystemRunning - /usr/bin/systemctl is-system-running : '%+v %s'", err, strings.TrimSpace(string(out))) for _, line := range strings.Split(string(out), "\n") { if strings.TrimSpace(line) == "starting" || strings.TrimSpace(line) == "running" || strings.TrimSpace(line) == "degraded" { DebugLog("IsSystemRunning - system is degraded/starting/running, match true") @@ -316,7 +316,7 @@ func CmpServiceStates(actStates, expStates string) bool { // WriteTunedAdmProfile write new profile to tuned, used instead of sometimes // unreliable 'tuned-adm' command func WriteTunedAdmProfile(profileName string) error { - err := os.WriteFile(actTunedProfile, []byte(profileName), 0644) + err := ioutil.WriteFile(actTunedProfile, []byte(profileName), 0644) if err != nil { return ErrorLog("Failed to write tuned profile '%s' to '%s': %v", profileName, actTunedProfile, err) } @@ -328,7 +328,7 @@ func WriteTunedAdmProfile(profileName string) error { // may be unreliable in newer tuned versions, so better use 'tuned-adm active' // Return empty string if it cannot be determined. func GetTunedProfile() string { - content, err := os.ReadFile(actTunedProfile) + content, err := ioutil.ReadFile(actTunedProfile) if err != nil { return "" } @@ -346,7 +346,7 @@ func TunedAdmOff() error { return nil } if out, err := exec.Command(tunedAdmCmd, "off").CombinedOutput(); err != nil { - return ErrorLog("Failed to call tuned-adm to switch off the active profile - %v %s", err, string(out)) + return ErrorLog("Failed to call tuned-adm to switch off the active profile - %v %s", err, strings.TrimSpace(string(out))) } return nil } @@ -356,7 +356,7 @@ func TunedAdmOff() error { // changed the behaviour/handling of the file /etc/tuned/active_profile func TunedAdmProfile(profileName string) error { if out, err := exec.Command(tunedAdmCmd, "profile", profileName).CombinedOutput(); err != nil { - return ErrorLog("Failed to call tuned-adm to active profile %s - %v %s", profileName, err, string(out)) + return ErrorLog("Failed to call tuned-adm to active profile %s - %v %s", profileName, err, strings.TrimSpace(string(out))) } return nil } @@ -366,7 +366,7 @@ func TunedAdmProfile(profileName string) error { func GetTunedAdmProfile() string { out, err := exec.Command(tunedAdmCmd, "active").CombinedOutput() if err != nil { - InfoLog("Failed to call tuned-adm to get the active profile - %v %s", err, string(out)) + InfoLog("Failed to call tuned-adm to get the active profile - %v %s", err, strings.TrimSpace(string(out))) return "" } re := regexp.MustCompile(`Current active profile: ([\w-]+)`) From ebfa2a872f21a8de29351d7a221aacf8ac77923e Mon Sep 17 00:00:00 2001 From: AngelaBriel Date: Thu, 7 Nov 2024 20:53:42 +0100 Subject: [PATCH 05/12] change wording for the color scheme reference in the description of the 'configure' command --- ospackage/man/saptune.8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ospackage/man/saptune.8 b/ospackage/man/saptune.8 index e18ac1f..d094a67 100644 --- a/ospackage/man/saptune.8 +++ b/ospackage/man/saptune.8 @@ -14,7 +14,7 @@ .\" * GNU General Public License for more details. .\" */ .\" -.TH saptune "8" "October 2024" "" "System optimization For SAP" +.TH saptune "8" "November 2024" "" "System optimization For SAP" .SH NAME saptune \- Comprehensive system optimization management for SAP solutions (\fBVersion 3\fP) @@ -704,7 +704,7 @@ Not all of the former variables will be available as configure option, only thos .SS .TP .B COLOR_SCHEME SCHEME -Default color scheme. See saptune verify --colorscheme SCHEME for available schemes. +Default color scheme. See 'saptune verify' in this man page for available color schemes. .TP .B SKIP_SYSCTL_FILES FILE[,FILE...] Comma-separated list of sysctl config files or directories which should be excluded when checking if parameters handled by saptune are handled by sysctl as well. From 8ce45ead3f4811f4d67851dbec8da9e0e530f2e7 Mon Sep 17 00:00:00 2001 From: AngelaBriel Date: Thu, 7 Nov 2024 20:55:33 +0100 Subject: [PATCH 06/12] option --fun is global and should be part of each command in the help output as well as in the SYNOPSIS part of the man page. (jsc#SAPSOL-272) --- actions/actions.go | 42 +++++++++++++++++++-------------------- ospackage/man/saptune.8 | 44 ++++++++++++++++++++--------------------- 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/actions/actions.go b/actions/actions.go index 08d8aa4..06eb592 100644 --- a/actions/actions.go +++ b/actions/actions.go @@ -300,40 +300,40 @@ func switchOffColor() { func cmdLineSyntax() string { return `saptune: Comprehensive system optimisation management for SAP solutions. Daemon control: - saptune [--format FORMAT] [--force-color] daemon ( start | stop | status [--non-compliance-check] ) ATTENTION: deprecated - saptune [--format FORMAT] [--force-color] service ( start | stop | restart | takeover | enable | disable | enablestart | disablestop | status [--non-compliance-check] ) + saptune [--format FORMAT] [--force-color] [--fun] daemon ( start | stop | status [--non-compliance-check] ) ATTENTION: deprecated + saptune [--format FORMAT] [--force-color] [--fun] service ( start | stop | restart | takeover | enable | disable | enablestart | disablestop | status [--non-compliance-check] ) Tune system according to SAP and SUSE notes: - saptune [--format FORMAT] [--force-color] note ( list | verify | revertall | enabled | applied ) - saptune [--format FORMAT] [--force-color] note ( apply | simulate | customise | create | edit | revert | show | delete ) NOTEID + saptune [--format FORMAT] [--force-color] [--fun] note ( list | verify | revertall | enabled | applied ) + saptune [--format FORMAT] [--force-color] [--fun] note ( apply | simulate | customise | create | edit | revert | show | delete ) NOTEID saptune [--format FORMAT] [--force-color] [--fun] note verify [--colorscheme SCHEME] [--show-non-compliant] [NOTEID|applied] - saptune [--format FORMAT] [--force-color] note rename NOTEID NEWNOTEID + saptune [--format FORMAT] [--force-color] [--fun] note rename NOTEID NEWNOTEID Tune system for all notes applicable to your SAP solution: - saptune [--format FORMAT] [--force-color] solution ( list | verify | enabled | applied ) - saptune [--format FORMAT] [--force-color] solution ( apply | simulate | customise | create | edit | revert | show | delete ) SOLUTIONNAME - saptune [--format FORMAT] [--force-color] solution change [--force] SOLUTIONNAME + saptune [--format FORMAT] [--force-color] [--fun] solution ( list | verify | enabled | applied ) + saptune [--format FORMAT] [--force-color] [--fun] solution ( apply | simulate | customise | create | edit | revert | show | delete ) SOLUTIONNAME + saptune [--format FORMAT] [--force-color] [--fun] solution change [--force] SOLUTIONNAME saptune [--format FORMAT] [--force-color] [--fun] solution verify [--colorscheme SCHEME] [--show-non-compliant] [SOLUTIONNAME] - saptune [--format FORMAT] [--force-color] solution rename SOLUTIONNAME NEWSOLUTIONNAME + saptune [--format FORMAT] [--force-color] [--fun] solution rename SOLUTIONNAME NEWSOLUTIONNAME Staging control: - saptune [--format FORMAT] [--force-color] staging ( status | enable | disable | is-enabled | list ) - saptune [--format FORMAT] [--force-color] staging ( analysis | diff ) [ ( NOTEID | SOLUTIONNAME )... | all ] - saptune [--format FORMAT] [--force-color] staging release [--force|--dry-run] [ ( NOTEID | SOLUTIONNAME )... | all ] + saptune [--format FORMAT] [--force-color] [--fun] staging ( status | enable | disable | is-enabled | list ) + saptune [--format FORMAT] [--force-color] [--fun] staging ( analysis | diff ) [ ( NOTEID | SOLUTIONNAME )... | all ] + saptune [--format FORMAT] [--force-color] [--fun] staging release [--force|--dry-run] [ ( NOTEID | SOLUTIONNAME )... | all ] Config (re-)settings: - saptune [--format FORMAT] [--force-color] configure ( COLOR_SCHEME | SKIP_SYSCTL_FILES | IGNORE_RELOAD | DEBUG ) Value - saptune [--format FORMAT] [--force-color] configure ( reset | show ) + saptune [--format FORMAT] [--force-color] [--fun] configure ( COLOR_SCHEME | SKIP_SYSCTL_FILES | IGNORE_RELOAD | DEBUG ) Value + saptune [--format FORMAT] [--force-color] [--fun] configure ( reset | show ) Verify all applied Notes: - saptune [--format FORMAT] [--force-color] verify applied + saptune [--format FORMAT] [--force-color] [--fun] verify applied Revert all parameters tuned by the SAP notes or solutions: - saptune [--format FORMAT] [--force-color] revert all + saptune [--format FORMAT] [--force-color] [--fun] revert all Remove the pending lock file from a former saptune call - saptune [--format FORMAT] [--force-color] lock remove + saptune [--format FORMAT] [--force-color] [--fun] lock remove Call external script '/usr/sbin/saptune_check' - saptune [--format FORMAT] [--force-color] check + saptune [--format FORMAT] [--force-color] [--fun] check Print current saptune status: - saptune [--format FORMAT] [--force-color] status [--non-compliance-check] + saptune [--format FORMAT] [--force-color] [--fun] status [--non-compliance-check] Print current saptune version: - saptune [--format FORMAT] [--force-color] version + saptune [--format FORMAT] [--force-color] [--fun] version Print this message: - saptune [--format FORMAT] [--force-color] help + saptune [--format FORMAT] [--force-color] [--fun] help Deprecation list: all 'saptune daemon' actions diff --git a/ospackage/man/saptune.8 b/ospackage/man/saptune.8 index d094a67..f05365d 100644 --- a/ospackage/man/saptune.8 +++ b/ospackage/man/saptune.8 @@ -21,67 +21,67 @@ saptune \- Comprehensive system optimization management for SAP solutions (\fBVe ATTENTION: If you still use version \fB1\fP of saptune it's now time to migrate to saptune version \fB3\fP, so please refer to man page saptune-migrate(7). .SH SYNOPSIS -\fBsaptune\fP [--format FORMAT] [--force-color] \fBdaemon\fP +\fBsaptune\fP [--format FORMAT] [--force-color] [--fun] \fBdaemon\fP ( start | stop | status [--non-compliance-check] ) \fBATTENTION: deprecated\fP -\fBsaptune\fP [--format FORMAT] [--force-color] \fBservice\fP +\fBsaptune\fP [--format FORMAT] [--force-color] [--fun] \fBservice\fP ( start | stop | restart | takeover | enable | disable | enablestart | disablestop | status [--non-compliance-check] ) -\fBsaptune\fP [--format FORMAT] [--force-color] \fBnote\fP +\fBsaptune\fP [--format FORMAT] [--force-color] [--fun] \fBnote\fP ( list | verify | revertall | enabled | applied ) -\fBsaptune\fP [--format FORMAT] [--force-color] \fBnote\fP +\fBsaptune\fP [--format FORMAT] [--force-color] [--fun] \fBnote\fP ( apply | simulate | customise | create | edit | revert | show | delete ) NOTEID -\fBsaptune\fP [--format FORMAT] [--force-color] \fBnote\fP +\fBsaptune\fP [--format FORMAT] [--force-color] [--fun] \fBnote\fP verify [--colorscheme SCHEME] [--show-non-compliant] [NOTEID|applied] -\fBsaptune\fP [--format FORMAT] [--force-color] \fBnote\fP +\fBsaptune\fP [--format FORMAT] [--force-color] [--fun] \fBnote\fP rename NOTEID NEWNOTEID -\fBsaptune\fP [--format FORMAT] [--force-color] \fBsolution\fP +\fBsaptune\fP [--format FORMAT] [--force-color] [--fun] \fBsolution\fP ( list | verify | enabled | applied ) -\fBsaptune\fP [--format FORMAT] [--force-color] \fBsolution\fP +\fBsaptune\fP [--format FORMAT] [--force-color] [--fun] \fBsolution\fP ( apply | simulate | customise | create | edit | revert | show | delete ) SOLUTIONNAME -\fBsaptune\fP [--format FORMAT] [--force-color] \fBsolution\fP +\fBsaptune\fP [--format FORMAT] [--force-color] [--fun] \fBsolution\fP change [--force] SOLUTIONNAME -\fBsaptune\fP [--format FORMAT] [--force-color] \fBsolution\fP +\fBsaptune\fP [--format FORMAT] [--force-color] [--fun] \fBsolution\fP verify [--colorscheme SCHEME] [--show-non-compliant] [SOLUTIONNAME] -\fBsaptune\fP [--format FORMAT] [--force-color] \fBsolution\fP +\fBsaptune\fP [--format FORMAT] [--force-color] [--fun] \fBsolution\fP rename SOLUTIONNAME NEWSOLUTIONNAME -\fBsaptune\fP [--format FORMAT] [--force-color] \fBstaging\fP +\fBsaptune\fP [--format FORMAT] [--force-color] [--fun] \fBstaging\fP ( status | enable | disable | is-enabled | list ) -\fBsaptune\fP [--format FORMAT] [--force-color] \fBstaging\fP +\fBsaptune\fP [--format FORMAT] [--force-color] [--fun] \fBstaging\fP ( analysis | diff ) [ ( NOTEID | SOLUTIONNAME )... | all ] -\fBsaptune\fP [--format FORMAT] [--force-color] \fBstaging\fP +\fBsaptune\fP [--format FORMAT] [--force-color] [--fun] \fBstaging\fP release [--force|--dry-run] [ ( NOTEID | SOLUTIONNAME )... | all ] -\fBsaptune\fP [--format FORMAT] [--force-color] \fBconfigure\fP +\fBsaptune\fP [--format FORMAT] [--force-color] [--fun] \fBconfigure\fP ( COLOR_SCHEME | SKIP_SYSCTL_FILES | IGNORE_RELOAD | DEBUG ) Value -\fBsaptune\fP [--format FORMAT] [--force-color] \fBconfigure\fP +\fBsaptune\fP [--format FORMAT] [--force-color] [--fun] \fBconfigure\fP ( reset | show ) -\fBsaptune\fP [--format FORMAT] [--force-color] \fBverify\fP +\fBsaptune\fP [--format FORMAT] [--force-color] [--fun] \fBverify\fP applied -\fBsaptune\fP [--format FORMAT] [--force-color] \fBrevert\fP +\fBsaptune\fP [--format FORMAT] [--force-color] [--fun] \fBrevert\fP all -\fBsaptune\fP [--format FORMAT] [--force-color] \fBcheck\fP +\fBsaptune\fP [--format FORMAT] [--force-color] [--fun] \fBcheck\fP -\fBsaptune\fP [--format FORMAT] [--force-color] \fBstatus [--non-compliance-check]\fP +\fBsaptune\fP [--format FORMAT] [--force-color] [--fun] \fBstatus [--non-compliance-check]\fP -\fBsaptune\fP [--format FORMAT] [--force-color] \fBversion\fP +\fBsaptune\fP [--format FORMAT] [--force-color] [--fun] \fBversion\fP -\fBsaptune\fP [--format FORMAT] [--force-color] \fBhelp\fP +\fBsaptune\fP [--format FORMAT] [--force-color] [--fun] \fBhelp\fP .SH DESCRIPTION saptune is designed to automate the configuration recommendations from SAP and SUSE to run an SAP application on SLES for SAP. These configuration recommendations are normally referred to as SAP Notes. So some dedicated SAP Notes are the base for the work of saptune. Additional some best practice guides are added as Note definitions to optimize the system for some really special cases. From fd1ecef04e32d057e9e57381d9447262649c42f7 Mon Sep 17 00:00:00 2001 From: AngelaBriel Date: Thu, 7 Nov 2024 20:58:28 +0100 Subject: [PATCH 07/12] adapt changes for THP from SAP Note 2684254 --- ospackage/man/saptune-note.5 | 6 +++--- ospackage/man/saptune.8 | 3 +++ ospackage/usr/share/saptune/notes/2684254 | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ospackage/man/saptune-note.5 b/ospackage/man/saptune-note.5 index 8a0c6bb..e6b0f6d 100644 --- a/ospackage/man/saptune-note.5 +++ b/ospackage/man/saptune-note.5 @@ -432,7 +432,7 @@ Configure C-States for lower latency in Linux (applies to Intel-based systems on Turn off autoNUMA balancing - see kernel.numa_balancing in section [sysctl] as 'alternative' settings .TP .BI transparent_hugepage=never -Disable transparent hugepages - see THP in section [vm] as 'alternative' settings +Configure transparent hugepages - see THP in section [vm] as 'alternative' settings \" section limits .SH "[limits]" The section "[limits]" is dealing with ulimit settings for user login sessions in the pam_limits module. The settings will \fBNOT\fP be done in the central limits file \fI/etc/security/limits.conf\fP. Instead there will be a \fBdrop-in file\fP in \fI/etc/security/limits.d\fP for each domain-item-type combination used in the Note definition file. @@ -653,9 +653,9 @@ The section "[vm]" manipulates \fI/sys/kernel/mm\fP switches. This section can to contain the following options: .TP .BI THP= STRING -This option disables transparent hugepages by changing \fI/sys/kernel/mm/transparent_hugepage/enabled\fP +This option configures transparent hugepages by changing \fI/sys/kernel/mm/transparent_hugepage/enabled\fP .br -Possible values are '\fBnever\fP' to disable and '\fBalways\fP' to enable. +Possible values are '\fBnever\fP' to disable, '\fBalways\fP' to enable and '\fBmadvise\fP'. .TP .BI KSM= INT Kernel Samepage Merging (KSM). KSM allows for an application to register with the kernel so as to have its memory pages merged with other processes that also register to have their pages merged. For KVM the KSM mechanism allows for guest virtual machines to share pages with each other. In today's environment where many of the guest operating systems like XEN, KVM are similar and are running on same host machine, this can result in significant memory savings, the default value is set to 0. diff --git a/ospackage/man/saptune.8 b/ospackage/man/saptune.8 index f05365d..31805b8 100644 --- a/ospackage/man/saptune.8 +++ b/ospackage/man/saptune.8 @@ -855,6 +855,9 @@ So we now \fBdeprecated\fP all "DAEMON ACTIONS" like '\fIsaptune daemon start\fP .TP .B version 3.1 With the update to saptune version 3.1 we \fBdeprecated\fP the actions '\fIsaptune note simulate\fP' and '\fIsaptune solution simulate\fP'. +.TP +.B version 3.2 +With the update to saptune version 3.2 we \fBdeprecated\fP the manual editing of the file \fI/etc/sysconfig/saptune\fP as the main configuration file will be (re)moved in future versions. .SH FILES .PP diff --git a/ospackage/usr/share/saptune/notes/2684254 b/ospackage/usr/share/saptune/notes/2684254 index 0f58382..e558e9b 100644 --- a/ospackage/usr/share/saptune/notes/2684254 +++ b/ospackage/usr/share/saptune/notes/2684254 @@ -3,7 +3,7 @@ [version] VERSION=24 -DATE=03.05.2023 +DATE=06.11.2024 DESCRIPTION=SAP HANA DB: Recommended OS settings for SLES 15 / SLES for SAP Applications 15 REFERENCES=https://me.sap.com/notes/2684254 @@ -26,9 +26,9 @@ THP=never KSM=0 [vm:os=15-SP5] -# Enable transparent hugepages (THP) +# Configure transparent hugepages (THP) # changes /sys/kernel/mm/transparent_hugepage/enabled -# 'never' to disable, 'always' to enable +# 'never' to disable, 'always' to enable or 'madvise' # 'madvise' will enter direct reclaim like 'always' but only for regions that # are have used madvise(MADV_HUGEPAGE). This is the default behaviour. # SAP Note 2131662, 2031375 From 8ae8f45972d7db63b2864dfba7080906c7e102fd Mon Sep 17 00:00:00 2001 From: AngelaBriel Date: Tue, 3 Dec 2024 16:00:18 +0100 Subject: [PATCH 08/12] add missing setting of net.core.somaxconn for 12SP5 and fix problem with an existing override file (bsc#1232212) --- ospackage/usr/share/saptune/notes/2382421 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ospackage/usr/share/saptune/notes/2382421 b/ospackage/usr/share/saptune/notes/2382421 index c422476..90ef241 100644 --- a/ospackage/usr/share/saptune/notes/2382421 +++ b/ospackage/usr/share/saptune/notes/2382421 @@ -146,21 +146,26 @@ net.ipv4.tcp_tw_reuse = # 8, which translates into a timeout of 190 seconds. net.ipv4.tcp_syn_retries = 8 -[sysctl:os=15-SP3] # This parameter limits the size of the accept backlog of a listening socket. -# The Linux default of 128 is not sufficient. You need to set the parameter -# to 4096 in order that the HANA system can use higher values. +# The Linux default of 128 on systems <= 15SP3 is not sufficient. You need to +# set the parameter to 4096 in order that the HANA system can use higher values. # There is an interdependency between this parameter and HANA configuration # parameter tcp_backlog. If net.core.somaxconn is set to a lower value than # tcp_backlog, tcp_backlog will be silently truncated to the value set for # net.core.somaxconn. Therefore, you need to ensure that net.core.somaxconn # is always set to a value equal to or greater than tcp_backlog. # net.core.somaxconn >= 4096 +# On systems >= 15SP4 the default value is sufficient. +net.core.somaxconn = + +[sysctl:os=15-SP3] net.core.somaxconn = 4096 [sysctl:os=15-SP2] net.core.somaxconn = 4096 [sysctl:os=15-SP1] net.core.somaxconn = 4096 +[sysctl:os=12-SP5] +net.core.somaxconn = 4096 [sysctl:os=12-SP3] # net.ipv4.tcp_tw_recycle From 2cd0800fc4a3ea659569122a6142c8b84fd19290 Mon Sep 17 00:00:00 2001 From: AngelaBriel Date: Tue, 3 Dec 2024 16:07:21 +0100 Subject: [PATCH 09/12] add new build flag for internal use --- development.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/development.md b/development.md index 4e0cc2c..ce4fe23 100644 --- a/development.md +++ b/development.md @@ -8,9 +8,10 @@ the sources should be available at $GOPATH/src/github.com/SUSE/saptune ## build saptune v3 cd $GOPATH/src/github.com/SUSE/saptune - version="3.0.0-test" + version="3.2.0-test" bdate=$(date +"%Y/%m/%d") - go build -ldflags "-X 'github.com/SUSE/saptune/actions.RPMVersion=$version' -X 'github.com/SUSE/saptune/actions.RPMDate=$bdate'" + bvers=15 + go build -ldflags "-X 'github.com/SUSE/saptune/actions.RPMVersion=$version' -X 'github.com/SUSE/saptune/actions.RPMDate=$bdate' -X '%{GONS}/%{name}/system.RPMBldVers=$bvers'" ## lint and format checks for the sources before committing changes From 591615f836c2da8123de1e83eacc00e8aff2157e Mon Sep 17 00:00:00 2001 From: AngelaBriel Date: Tue, 3 Dec 2024 16:09:32 +0100 Subject: [PATCH 10/12] change debug messages for systemctl commands --- system/daemon.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/system/daemon.go b/system/daemon.go index 46b78c7..6334885 100644 --- a/system/daemon.go +++ b/system/daemon.go @@ -76,11 +76,12 @@ func execSystemctlCmd(service, cmd string) error { return ErrorLog("%v - Failed to call systemctl %s on %s", err, cmd, service) } if running { + DebugLog("execSystemctlCmd, called from '%v' - executing command '%s %s %s'", CalledFrom(), systemctlCmd, cmd, service) out, err := exec.Command(systemctlCmd, cmd, service).CombinedOutput() if err != nil { return ErrorLog("%v - Failed to call systemctl %s on %s - %s", err, cmd, service, strings.TrimSpace(string(out))) } - DebugLog("execSystemctlCmd, called from '%v' - /usr/bin/systemctl %s '%s' : '%+v %s'", CalledFrom(), cmd, service, err, strings.TrimSpace(string(out))) + DebugLog("execSystemctlCmd, called from '%v' - command '%s %s %s' returned '%+v : %s'", CalledFrom(), systemctlCmd, cmd, service, err, strings.TrimSpace(string(out))) } return nil } From 37b3bbf0843cca1bf06864a0b21c7dc706857ee2 Mon Sep 17 00:00:00 2001 From: AngelaBriel Date: Tue, 3 Dec 2024 16:14:16 +0100 Subject: [PATCH 11/12] clarify the syntax of the solution name used with the staging command in the help output and in the man page. We need the '.sol' extention in the command line to detect the right file to read from. --- actions/actions.go | 4 ++-- ospackage/man/saptune.8 | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/actions/actions.go b/actions/actions.go index 06eb592..39bd22a 100644 --- a/actions/actions.go +++ b/actions/actions.go @@ -315,8 +315,8 @@ Tune system for all notes applicable to your SAP solution: saptune [--format FORMAT] [--force-color] [--fun] solution rename SOLUTIONNAME NEWSOLUTIONNAME Staging control: saptune [--format FORMAT] [--force-color] [--fun] staging ( status | enable | disable | is-enabled | list ) - saptune [--format FORMAT] [--force-color] [--fun] staging ( analysis | diff ) [ ( NOTEID | SOLUTIONNAME )... | all ] - saptune [--format FORMAT] [--force-color] [--fun] staging release [--force|--dry-run] [ ( NOTEID | SOLUTIONNAME )... | all ] + saptune [--format FORMAT] [--force-color] [--fun] staging ( analysis | diff ) [ ( NOTEID | SOLUTIONNAME.sol )... | all ] + saptune [--format FORMAT] [--force-color] [--fun] staging release [--force|--dry-run] [ ( NOTEID | SOLUTIONNAME.sol )... | all ] Config (re-)settings: saptune [--format FORMAT] [--force-color] [--fun] configure ( COLOR_SCHEME | SKIP_SYSCTL_FILES | IGNORE_RELOAD | DEBUG ) Value saptune [--format FORMAT] [--force-color] [--fun] configure ( reset | show ) diff --git a/ospackage/man/saptune.8 b/ospackage/man/saptune.8 index 31805b8..080f66d 100644 --- a/ospackage/man/saptune.8 +++ b/ospackage/man/saptune.8 @@ -58,10 +58,10 @@ rename SOLUTIONNAME NEWSOLUTIONNAME ( status | enable | disable | is-enabled | list ) \fBsaptune\fP [--format FORMAT] [--force-color] [--fun] \fBstaging\fP -( analysis | diff ) [ ( NOTEID | SOLUTIONNAME )... | all ] +( analysis | diff ) [ ( NOTEID | SOLUTIONNAME.sol )... | all ] \fBsaptune\fP [--format FORMAT] [--force-color] [--fun] \fBstaging\fP -release [--force|--dry-run] [ ( NOTEID | SOLUTIONNAME )... | all ] +release [--force|--dry-run] [ ( NOTEID | SOLUTIONNAME.sol )... | all ] \fBsaptune\fP [--format FORMAT] [--force-color] [--fun] \fBconfigure\fP ( COLOR_SCHEME | SKIP_SYSCTL_FILES | IGNORE_RELOAD | DEBUG ) Value @@ -672,7 +672,7 @@ The solution definition is shown as a whole object. It is only possible to relea .br Lastly a hint is printed to remind the user that he has to release staged objects before he can use them and that it is possible to view the changes. .TP -.B diff [ ( NOTEID | SOLUTIONNAME )... | all ] +.B diff [ ( NOTEID | SOLUTIONNAME.sol )... | all ] Shows the differences between the Note (or all Notes) or the Solution definition in the staging area and the working area. .br For each Note in the staging area the output contains the values of all parameter which differ. This includes new or removed parameters as well as changes in the reminder section. @@ -681,12 +681,12 @@ For the Solution, all changed solutions are displayed with their differences. .br Lastly a hint is printed to remind the user that he has to release staged objects before he can use them. .TP -.B analysis [ ( NOTEID | SOLUTIONNAME )... | all ] +.B analysis [ ( NOTEID | SOLUTIONNAME.sol )... | all ] Does an analysis of the requested Notes, the Solution definitions or everything in the staging area to warn the user about possible issues or additional steps to perform. .br Lastly a hint is printed to remind the user that he has to release staged objects before he can use them as well that he should check out the differences. .TP -.B release [ ( NOTEID | SOLUTIONNAME )... | all ] +.B release [ ( NOTEID | SOLUTIONNAME.sol )... | all ] Releases the requested Notes, the Solution definitions or everything in the stages area. .br This means the Notes or the Solution definitions get moved from the staging area to the working area. In case of a deleted Note/Solution, it will be removed from the working area. From f76b0de572c283f2e8c2acb1cc5d2b7ccd042eaf Mon Sep 17 00:00:00 2001 From: AngelaBriel Date: Tue, 3 Dec 2024 17:22:52 +0100 Subject: [PATCH 12/12] the check in 'note delete', if the note is part of a solution and then block deleting, is moved behind the deletion of an existing override file and only needed, if it's a custom note because the internal shipped notes can not be deleted at all. --- actions/noteacts.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/actions/noteacts.go b/actions/noteacts.go index 14c204d..a6ce3f2 100644 --- a/actions/noteacts.go +++ b/actions/noteacts.go @@ -334,10 +334,6 @@ func NoteActionDelete(reader io.Reader, writer io.Writer, noteID string, tuneApp if !extraNote && !overrideNote { system.ErrorExit("The Note definition file you want to delete is a saptune internal (shipped) Note and can NOT be deleted. Exiting ...") } - inSolution, _ := getNoteInSol(tuneApp, noteID) - if inSolution != "" { - system.ErrorExit("The Note definition file you want to delete is part of a Solution(s) (%s). Please fix the Solution first and then try deleting again.", inSolution) - } if !extraNote && overrideNote { // system note, override file exists @@ -354,6 +350,10 @@ func NoteActionDelete(reader io.Reader, writer io.Writer, noteID string, tuneApp } } if extraNote { + inSolution, _ := getNoteInSol(tuneApp, noteID) + if inSolution != "" { + system.ErrorExit("The Note definition file you want to delete is part of a Solution(s) (%s). Please fix the Solution first and then try deleting again.", inSolution) + } // custom note txtConfirm = fmt.Sprintf("Note to delete is a customer/vendor specific Note.\nDo you really want to delete this Note (%s)?", noteID) // remove customer/vendor specific note definition file