Skip to content

Commit

Permalink
test: Use grubby to set crashkernel= option
Browse files Browse the repository at this point in the history
This now works on all our Fedora/RHEL/CentOS images, and grubby is the
official tool to do that. Directly editing /boot/grub2/grubenv is not
supported, as it says prominently on the top:
"WARNING: Do not edit this file by tools other than grub-editenv!!!"

Both editing grubenv and specifying boot options in /etc/default/grub
stopped working on the current RHEL 9.0 image.
  • Loading branch information
martinpitt committed Apr 23, 2021
1 parent 0748bc2 commit 3ca4a5f
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions test/verify/check-kdump
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,8 @@ class TestKdump(MachineCase):
return new.join(li)

def enableKdump(self):
if self.machine.image in ["rhel-8-4", "rhel-8-5"]:
# these images use BootLoaderSpec and grubenv
self.sed_file('/^kernelopts=/ { s/crashkernel=[^ ]*//; s/$/ crashkernel=256M/; }', '/boot/grub2/grubenv')
else:
lines = self.machine.execute(command="cat /etc/default/grub", quiet=True).split("\n")
lines = map(lambda line: self.rreplace(line, '"', ' crashkernel=256M"', 1)
if line.startswith("GRUB_CMDLINE_LINUX") else line, lines)
self.machine.write("/etc/default/grub", "\n".join(lines))
self.machine.execute("grub2-mkconfig -o /boot/grub2/grub.cfg")
# 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")

def enableLocalSsh(self):
Expand Down

0 comments on commit 3ca4a5f

Please sign in to comment.