Skip to content

Commit

Permalink
kdump: RHEL/Fedora now defaults to setting crashkernel
Browse files Browse the repository at this point in the history
In Fedora-39 and all supported RHEL versions (8 and 9) crashkernel is
now set in the default cmdline. RHEL also defaults in enabling
kdump.service which Fedora does not.

This simplifies our testing as we don't have to re-generate initrd and
reboot. Plus this means we test the distribution default which is a lot
more useful then an arbitrary setting we came up with.
  • Loading branch information
jelly authored and martinpitt committed Oct 13, 2023
1 parent 688a044 commit 5b27a1b
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions test/verify/check-kdump
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,20 @@ from lib.constants import TEST_OS_DEFAULT


class KdumpHelpers(testlib.MachineCase):
def setUp(self):
super().setUp()
self.allow_restart_journal_messages()
self.machine.execute("mkdir -p /var/crash")

def enableKdump(self):
# all current Fedora/CentOS/RHEL images use BootLoaderSpec
self.machine.execute("grubby --args=crashkernel=256M --update-kernel=ALL")
self.machine.execute("mkdir -p /var/crash")
self.machine.reboot()
self.allow_restart_journal_messages()
self.machine.start_cockpit()
self.browser.switch_to_top()
self.browser.relogin("/kdump")
if self.machine.image == "fedora-38":
self.machine.execute("grubby --args=crashkernel=192M --update-kernel=ALL")
self.machine.reboot()

self.machine.start_cockpit()
self.browser.switch_to_top()
self.browser.relogin("/kdump")

def crashKernel(self, message, cancel=False):
b = self.browser
Expand Down Expand Up @@ -68,7 +73,10 @@ class TestKdump(KdumpHelpers):
m = self.machine

b.wait_timeout(120)
m.execute("systemctl enable kdump; systemctl start kdump || true")
if m.image.startswith("fedora"):
m.execute("systemctl enable --now kdump")
else:
m.execute("until systemctl is-active kdump; do sleep 1; done")

self.login_and_go("/kdump")

Expand Down Expand Up @@ -147,8 +155,8 @@ class TestKdump(KdumpHelpers):
b.wait_not_present(pathInput)
self.crashKernel("copied through SSH to root@localhost:/var/crash as vmcore", cancel=True)

# we should have the amount of memory reserved that we indicated
b.wait_in_text("#app", "256 MiB")
# we should have the amount of memory reserved that crashkernel=auto defaults to for our VM RAM size
b.wait_in_text("#app", "192 MiB")
# service should start up properly and the button should be on
b.wait_in_text("#app", "Service is running")
assertActive(active=True)
Expand Down Expand Up @@ -416,8 +424,6 @@ class TestKdumpNFS(KdumpHelpers):
self.machines["nfs"].write("/etc/exports", "/srv/kdump 10.111.113.0/24(rw,no_root_squash)\n")
self.machines["nfs"].execute("mkdir -p /srv/kdump/var/crash; firewall-cmd --add-service nfs; systemctl restart nfs-server")

# set up client machine
m.execute("systemctl disable kdump")
# ensure there is no local /var/crash, should not break kdump
m.execute("rmdir /var/crash")
self.login_and_go("/kdump")
Expand All @@ -435,10 +441,11 @@ class TestKdumpNFS(KdumpHelpers):
b.wait_not_present("#kdump-settings-dialog")

# enable service, regenerates initrd and tests NFS settings
b.wait_visible(".pf-v5-c-switch__input:not(:checked)")
b.click(".pf-v5-c-switch__input")
with b.wait_timeout(300):
b.wait_visible(".pf-v5-c-switch__input:checked")
if m.image.startswith("fedora"):
b.wait_visible(".pf-v5-c-switch__input:not(:checked)")
b.click(".pf-v5-c-switch__input")
with b.wait_timeout(300):
b.wait_visible(".pf-v5-c-switch__input:checked")
b.wait_in_text("#app", "Service is running")

# explicit nfs option, unset path
Expand Down

0 comments on commit 5b27a1b

Please sign in to comment.