From 4fc59c956b50764827f1b7ce4078b45eaf2185d3 Mon Sep 17 00:00:00 2001 From: Sachin P Bappalige Date: Tue, 23 Apr 2024 10:58:10 +0530 Subject: [PATCH] Fix kdump/Fadump config ServiceReport fails to estimate correct crashkernel size. This is a temporary fix to define crashkernel size. Signed-off-by: Sachin P Bappalige --- op-test | 4 ++-- testcases/PowerNVDump.py | 45 +++++++++++++++++++++++++++------------- 2 files changed, 33 insertions(+), 16 deletions(-) diff --git a/op-test b/op-test index a33c50a5..629f4a0f 100755 --- a/op-test +++ b/op-test @@ -693,15 +693,15 @@ class OSdumpfadumpSuite(): def __init__(self): self.s = unittest.TestSuite() self.s.addTest(PowerNVDump.KernelCrash_FadumpEnable()) - self.s.addTest(PowerNVDump.OpTestMakedump()) self.s.addTest(PowerNVDump.KernelCrash_KdumpDLPAR()) self.s.addTest(PowerNVDump.KernelCrash_KdumpWorkLoad()) self.s.addTest(PowerNVDump.KernelCrash_hugepage_checks()) self.s.addTest(PowerNVDump.KernelCrash_XIVE_off()) self.s.addTest(PowerNVDump.KernelCrash_disable_radix()) - self.s.addTest(PowerNVDump.KernelCrash_FadumpNocma()) + self.s.addTest(PowerNVDump.OpTestMakedump()) self.s.addTest(PowerNVDump.KernelCrash_KdumpSSH()) self.s.addTest(PowerNVDump.KernelCrash_KdumpNFS()) + self.s.addTest(PowerNVDump.KernelCrash_FadumpNocma()) def suite(self): return self.s diff --git a/testcases/PowerNVDump.py b/testcases/PowerNVDump.py index c54f57df..1eccacc5 100644 --- a/testcases/PowerNVDump.py +++ b/testcases/PowerNVDump.py @@ -294,8 +294,7 @@ def verify_fadump_reg(self): if int(res) == 1: return True else: - self.c.run_command("echo 1 > /sys/kernel/fadump_registered") - self.c.run_command('\r\n') + self.c.run_command("echo 1 > /sys/kernel/fadump_registered; sleep 10") self.c.run_command("cat /sys/kernel/fadump_registered") if not self.is_lpar: @@ -330,14 +329,12 @@ def verify_fadump_unreg(self): if int(res) == 0: return True else: - self.c.run_command("echo 0 > /sys/kernel/fadump_registered") - self.c.run_command('\r\n') + self.c.run_command("echo 0 > /sys/kernel/fadump_registered; sleep 10") if not self.is_lpar: self.c.run_command("%s > /tmp/opal_log" % BMC_CONST.OPAL_MSG_LOG) self.c.run_command("dmesg > /tmp/dmesg_log") - self.c.run_command("echo 0 > /sys/kernel/fadump_registered") - self.c.run_command('\r\n') + self.c.run_command("echo 0 > /sys/kernel/fadump_registered; sleep 10") opal_data = " ".join(self.c.run_command( "%s | diff -a /tmp/opal_log -" % BMC_CONST.OPAL_MSG_LOG)) @@ -632,14 +629,10 @@ def setup_fadump(self): ''' self.cv_SYSTEM.set_state(OpSystemState.OS) if self.distro == "rhel": - self.c.run_command("git clone https://github.com/linux-ras/ServiceReport; cd ServiceReport;" + self.c.run_command("rm -rf ServiceReport; git clone https://github.com/linux-ras/ServiceReport; cd ServiceReport;" "python ./servicereport --plugins kdump package --repair", timeout=240) time.sleep(10) self.c.run_command("sed -e '/nfs/ s/^#*/#/' -i /etc/kdump.conf; sync") - obj = OpTestInstallUtil.InstallUtil() - if not obj.update_kernel_cmdline(self.distro, args="fadump=on", - reboot=True, reboot_cmd=True): - self.fail("KernelArgTest failed to update kernel args") if self.distro == "sles": self.c.run_command('sed -i \'/^KDUMP_SAVEDIR=/c\KDUMP_SAVEDIR=\"/var/crash\"\' /etc/sysconfig/kdump;') self.c.run_command("sed -i '/KDUMP_FADUMP=\"no\"/c\KDUMP_FADUMP=\"yes\"' /etc/sysconfig/kdump") @@ -649,6 +642,10 @@ def setup_fadump(self): self.c.run_command("zypper install -y ServiceReport; servicereport -r -p kdump;" "update-bootloader --refresh", timeout=240) time.sleep(5) + obj = OpTestInstallUtil.InstallUtil() + if not obj.update_kernel_cmdline(self.distro, args="fadump=on crashkernel=2G-128G:4096M,128G-:8192M", + reboot=True, reboot_cmd=True): + self.fail("KernelArgTest failed to update kernel args") self.cv_SYSTEM.goto_state(OpSystemState.OFF) self.cv_SYSTEM.goto_state(OpSystemState.OS) @@ -682,9 +679,10 @@ def runTest(self): log.debug("======================fadump is supported=======================") log.info("========== Testing Fadump enable followed by crash ==============") boot_type = self.kernel_crash() + self.verify_dump_file(boot_type) if not self.is_lpar: self.verify_dump_dt_node(boot_type) - self.verify_dump_file(boot_type) + self.verify_dump_file(boot_type) class KernelCrash_OnlyKdumpEnable(PowerNVDump): @@ -711,6 +709,12 @@ def runTest(self): self.c.run_command("zypper install -y ServiceReport; servicereport -r -p kdump;" "update-bootloader --refresh", timeout=240) time.sleep(5) + + obj = OpTestInstallUtil.InstallUtil() + if not obj.update_kernel_cmdline(self.distro, args="crashkernel=2048M", + reboot=True, reboot_cmd=True): + self.fail("KernelArgTest failed to update kernel args") + self.cv_SYSTEM.goto_state(OpSystemState.OFF) self.cv_SYSTEM.goto_state(OpSystemState.OS) @@ -718,7 +722,7 @@ def runTest(self): self.cv_HOST.host_check_command("kdump") elif self.distro == "rhel": self.cv_HOST.host_check_command("kdumpctl") - self.c.run_command("git clone https://github.com/linux-ras/ServiceReport; cd ServiceReport;" + self.c.run_command("rm -rf ServiceReport; git clone https://github.com/linux-ras/ServiceReport; cd ServiceReport;" "python ./servicereport --plugins kdump package --repair", timeout=240) time.sleep(10) elif self.distro == "sles": @@ -733,9 +737,10 @@ def runTest(self): self.cv_HOST.host_enable_kdump_service(os_level) log.info("========= Testing Only kdump enable followed by crash ===========") boot_type = self.kernel_crash() + self.verify_dump_file(boot_type) if self.is_lpar: boot_type = self.kernel_crash(crash_type="hmc") - self.verify_dump_file(boot_type) + self.verify_dump_file(boot_type) class KernelCrash_DisableAll(PowerNVDump): @@ -1127,6 +1132,10 @@ class KernelCrash_XIVE_off(PowerNVDump): ''' def runTest(self): + obj = OpTestInstallUtil.InstallUtil() + if not obj.update_kernel_cmdline(self.distro, remove_args="default_hugepagesz=1GB hugepagesz=1GB hugepages=80", + reboot=True, reboot_cmd=True): + self.fail("KernelArgTest failed to remove kernel args:default_hugepagesz=1GB hugepagesz=1GB hugepages=80") self.cv_SYSTEM.goto_state(OpSystemState.OS) self.setup_test() log.info("=============== Testing kdump/fadump with xive=off ===============") @@ -1171,6 +1180,10 @@ class KernelCrash_disable_radix(PowerNVDump): ''' def runTest(self): + obj = OpTestInstallUtil.InstallUtil() + if not obj.update_kernel_cmdline(self.distro, remove_args="xive=off", + reboot=True, reboot_cmd=True): + self.fail("KernelArgTest failed to remove kernel args:xive=off") self.cv_SYSTEM.goto_state(OpSystemState.OS) self.setup_test() log.info("Testing kdump/fadump with disable_radix") @@ -1279,6 +1292,10 @@ def makedump_check(self): self.c.run_command("rm -rf dump*") def runTest(self): + obj = OpTestInstallUtil.InstallUtil() + if not obj.update_kernel_cmdline(self.distro, remove_args="disable_radix", + reboot=True, reboot_cmd=True): + self.fail("KernelArgTest failed to remove kernel args:disable_radix") self.kernel_crash() self.makedump_check()