Skip to content

Conversation

@adityagesh
Copy link
Collaborator

  1. Kdump currently has a lot of failures when sufficient disk space is not present, add disk using platform when additional space is required.
  2. Add fstab entry when partition used to store crashdump is not root partition - observed some cases where kdump service fails to start after rebooting due to mount issues.
  3. Refactoring

@adityagesh adityagesh requested a review from LiliDeng as a code owner December 9, 2025 15:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request enhances the kdump test suite to handle insufficient disk space scenarios and improve reliability across reboots. The changes address kdump failures when systems lack sufficient disk space by dynamically adding data disks when needed, and ensure mount points persist across reboots by adding fstab entries.

Key Changes:

  • Introduced a new Fstab tool for managing /etc/fstab entries programmatically
  • Enhanced kdump to calculate required disk space based on system memory and dynamically provision disks when needed
  • Added mount persistence logic to prevent kdump service failures after reboot
  • Refactored code to use tool abstractions (Mkdir, Ls) instead of raw execute commands
  • Fixed Oracle Linux grubby command to remove existing crashkernel parameters before adding new ones

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
lisa/tools/fstab.py New tool for managing /etc/fstab entries with methods to read, add, and ensure entries with UUID support
lisa/tools/kdump.py Enhanced disk space management with dynamic provisioning, added mount persistence, refactored to use tool abstractions, and improved Oracle Linux crashkernel configuration
lisa/tools/init.py Exported new Fstab and FstabEntry classes

Test Suggestions:

According to the LISA Testing Guidelines, all code reviews must include test suggestions. Here are the recommendations for this PR:

Key Test Cases:

verify_kdumpcrash_single_core|verify_kdumpcrash_smp|verify_kdumpcrash_auto_size|verify_kdumpcrash_large_memory_auto_size

Impacted LISA Features:
Disk, StartStop, SerialConsole

Tested Azure Marketplace Images:

  • canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest
  • redhat rhel 9_5 latest
  • oracle oracle-linux ol94-lvm-gen2 latest
  • debian debian-12 12-gen2 latest
  • microsoftcblmariner azure-linux-3 azure-linux-3-gen2 latest

Rationale:

  • The test cases cover single-core, multi-core, auto-size crashkernel, and large memory scenarios which exercise the new disk provisioning and mount persistence logic
  • Oracle Linux images are critical to test the grubby command changes for crashkernel configuration
  • A variety of distributions ensures the fstab and disk management changes work across different OS families
  • Gen2 images are prioritized as they represent newer VM generations commonly used in production

adityagesh and others added 3 commits December 10, 2025 08:53
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@property
def command(self) -> str:
# fstab is a file, not a command
return "cat"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since fstab actually is not a tool, can we have this placed else where? or are we doing this solely because we want to import it in kdump tool?
Also why does it have to be cat? below we are importing cat anyway to read from the FSTAB_PATH

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is implemented as a tool to provide an abstraction for standard linux fstab, it's not due to import in kdump tool
I don't think command can be empty, hence used cat. I'll recheck if it can be empty

options: str = "defaults",
dump: int = 0,
pass_num: int = 2,
use_uuid: bool = True,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sicne this is being implemented, do you want to also add a simple option to override/force flag this is to update instead of returning from the method if an entry exists.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have that use case right now. I would prefer it to updated in that way when a use case arises

Comment on lines +194 to +201
else:
self._log.info(
f"Could not get UUID for {device}, using device name"
)
except LisaException as e:
self._log.info(
f"Could not get UUID for {device}: {e}. Using device name"
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have an else condition and an except for the same reasoning.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I'll remove the else block

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thoughts, this is correct.
We need the if else to handle scenario where an entry exists, but UUID is empty.

Meaning,

partition_info = blkid.get_partition_info_by_name(
device, force_run=True
)

returns without exception, but the UUID field is empty


# Try to add a data disk if platform supports it
try:
return self._try_add_data_disk_for_dump(required_space_gb)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You had previously mentioned about exploring ways to provision the VM itself with enough disk space based on memory, is that option ruled out?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, since kdump does not have to be configured in root disk, I feel this is a better approach.
However, the os disk size requirement would be implemented for Hibernation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants