Skip to content

Add swap file checking in verify_no_swap_on_osdisk #3903

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 3, 2025
Merged

Conversation

lubaihua33
Copy link
Collaborator

No description provided.

@LiliDeng LiliDeng requested a review from Copilot July 2, 2025 07:14
Copy link
Contributor

@Copilot 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

Adds swap file detection to the existing OS-disk swap verification and refactors the swap tool to return structured data.

  • Extended verify_no_swap_on_osdisk to detect both swap partitions and swap files, with updated logging and error messages.
  • Introduced a new SwapPartition dataclass and updated SwapOn.get_swap_partitions to return List[SwapPartition] instead of List[str].
  • Enhanced the swap tool to use Df for resolving swap-file partitions and improved code organization.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
microsoft/testsuites/core/azure_image_standard.py Updated test metadata, documentation, logging, and exception messages to include swap files.
lisa/tools/swap.py Added SwapPartition dataclass, updated imports, and refactored get_swap_partitions logic.
Comments suppressed due to low confidence (3)

lisa/tools/swap.py:19

  • Add a docstring to the SwapPartition dataclass explaining its fields (filename, type, partition) to improve clarity.
@dataclass

lisa/tools/swap.py:78

  • Changing the return type from List[str] to List[SwapPartition] is a breaking API change—update the method docstring and communicate this change to callers or provide a migration path.
    def get_swap_partitions(self) -> List[SwapPartition]:

microsoft/testsuites/core/azure_image_standard.py:1647

  • The error message refers to 'Swap Partition on OS Disk'—update it to consistently mention swap files (e.g. 'Swap partition or file on OS Disk') to match the test description.
                            f"Swap partition/file '{swap_part.filename}' is found on "

@LiliDeng
Copy link
Collaborator

LiliDeng commented Jul 3, 2025

@squirrelsc LGTM.

@squirrelsc
Copy link
Member

Pull Request Overview

Adds swap file detection to the existing OS-disk swap verification and refactors the swap tool to return structured data.

  • Extended verify_no_swap_on_osdisk to detect both swap partitions and swap files, with updated logging and error messages.
  • Introduced a new SwapPartition dataclass and updated SwapOn.get_swap_partitions to return List[SwapPartition] instead of List[str].
  • Enhanced the swap tool to use Df for resolving swap-file partitions and improved code organization.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
microsoft/testsuites/core/azure_image_standard.py Updated test metadata, documentation, logging, and exception messages to include swap files.
lisa/tools/swap.py Added SwapPartition dataclass, updated imports, and refactored get_swap_partitions logic.
Comments suppressed due to low confidence (3)
lisa/tools/swap.py:19

  • Add a docstring to the SwapPartition dataclass explaining its fields (filename, type, partition) to improve clarity.
@dataclass

lisa/tools/swap.py:78

  • Changing the return type from List[str] to List[SwapPartition] is a breaking API change—update the method docstring and communicate this change to callers or provide a migration path.
    def get_swap_partitions(self) -> List[SwapPartition]:

microsoft/testsuites/core/azure_image_standard.py:1647

  • The error message refers to 'Swap Partition on OS Disk'—update it to consistently mention swap files (e.g. 'Swap partition or file on OS Disk') to match the test description.
                            f"Swap partition/file '{swap_part.filename}' is found on "

Please provide test suggestions.

@LiliDeng LiliDeng merged commit d2d7c32 into main Jul 3, 2025
53 checks passed
@LiliDeng LiliDeng deleted the baihua/swap_file branch July 3, 2025 05:18
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.

3 participants