Skip to content
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

NVMe and resource disc testcase fixes #3432

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SRIKKANTH
Copy link
Collaborator

@SRIKKANTH SRIKKANTH commented Sep 20, 2024

NVMe and resource disc testcase fixes

  1. Added new testcase "Nvme.verify_nvme_function_unpartitioned".
  2. NVMe test case fixes for disc controller type NVMe.
  3. Resource disc testcases fixes for VMs with Local NVMEs.
  4. "Nvme.verify_nvme_fstrim" - use fstrim test file size based on available space.

@SRIKKANTH
Copy link
Collaborator Author

SRIKKANTH commented Sep 20, 2024

This PR has a dependency on #3420

Please merge #3420 before accepting this PR so that lspci changes are part of different PR. and not clubbed with NVMe changes

@SRIKKANTH SRIKKANTH force-pushed the smyakam/nvme_test_fixes_15_09_2024 branch from c7e4a17 to bd7d0e2 Compare September 24, 2024 04:20
@SRIKKANTH SRIKKANTH marked this pull request as draft October 23, 2024 03:28
@SRIKKANTH SRIKKANTH force-pushed the smyakam/nvme_test_fixes_15_09_2024 branch 2 times, most recently from f76263a to 5855bb7 Compare October 23, 2024 03:42
@SRIKKANTH SRIKKANTH force-pushed the smyakam/nvme_test_fixes_15_09_2024 branch 4 times, most recently from 207c2b8 to 7bb2e16 Compare November 12, 2024 10:49
NVMe and resource disc testcase fixes

1. Added new testcase "Nvme.verify_nvme_function_unpartitioned".
2. NVMe test case fixes for disc controller type NVMe.
3. Resource disc testcases fixes for VMs with Local NVMEs.
4. "Nvme.verify_nvme_fstrim" - use fstrim testfile size based on available space.
@SRIKKANTH SRIKKANTH force-pushed the smyakam/nvme_test_fixes_15_09_2024 branch from b402609 to b29f14e Compare November 12, 2024 11:39
@SRIKKANTH SRIKKANTH marked this pull request as ready for review November 12, 2024 11:45
@SRIKKANTH SRIKKANTH changed the title NVMe testcase fixes for ASAP VMs NVMe and resource disc testcase fixes Nov 12, 2024
@@ -78,7 +93,17 @@ def get_namespaces(self) -> List[str]:
return namespaces

def get_namespaces_from_cli(self) -> List[str]:
return self._node.tools[Nvmecli].get_namespaces()
namespaces_list = self._node.tools[Nvmecli].get_namespaces()
node_disk = self._node.features[Disk]
Copy link
Member

Choose a reason for hiding this comment

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

The logic is repeated multiple times, it should be a new method like _remove_nvme_os_disk.

raise LisaException("Resource disk not found")
if "nvme" in resource_disks[0]:
raise SkippedException(
f"Resource disk type is NVMe and the VM has {len(resource_disks)} NVMe disks" # noqa: E501
Copy link
Member

Choose a reason for hiding this comment

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

The skip message doesn't explain why nvme disk should be skipped.

@@ -71,6 +71,9 @@ def _initialize(self, *args: Any, **kwargs: Any) -> None:
def get_resource_disk_mount_point(self) -> str:
raise NotImplementedError

def get_resource_disks(self) -> List[str]:
Copy link
Member

Choose a reason for hiding this comment

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

The default implementation should return an empty list, because "resource disk" is a concept on cloud or Azure, not all platforms. All test cases, which used the resource disk, should handle the empty list.

)
if resourcedisk:
resource_disks = [resourcedisk.name]
except AssertionError:
Copy link
Member

Choose a reason for hiding this comment

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

Is there a way not check by the error? The error can be happened by other reasons, the eating code may hide other problems.

f"'WARNING: THIS IS A TEMPORARY DISK' should be present in {file_path}",
).contains("WARNING: THIS IS A TEMPORARY DISK")
node_disc = node.features[Disk]
resource_disks = node_disc.get_resource_disks()
Copy link
Member

Choose a reason for hiding this comment

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

Add a method in Disk feature, called like get_disk_controller_type, and it accept mount point as a parameter. Please also reduce duplicate code with existing get_os_disk_controller_type.

resource_disks = node_disc.get_resource_disks()
if not resource_disks:
raise LisaException("Resource disk not found")
if "nvme" in resource_disks[0]:
Copy link
Member

Choose a reason for hiding this comment

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

As above comments, use the type enum, instead of checking by string.

raise LisaException("Resource disk not found")
if "nvme" in resource_disks[0]:
raise SkippedException(
f"Resource disk type is NVMe and the VM has {len(resource_disks)} NVMe disks" # noqa: E501
Copy link
Member

Choose a reason for hiding this comment

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

This error message is unclear, why the tests should be skipped, if the resource disk is nvme. Please check if it's valid to skip for nvme, if so, update the description.

# Verify lost+found folder exists
# Skip this step for BSD as it does not have lost+found folder
# since it uses UFS file system
if not isinstance(node.os, BSD):
Copy link
Member

Choose a reason for hiding this comment

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

Is it miscopied from above lines/ They are looks the same as above parts.

resource_disks = node_disc.get_resource_disks()
if not resource_disks:
raise LisaException("Resource disk not found")
if "nvme" in resource_disks[0]:
Copy link
Member

Choose a reason for hiding this comment

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

Wrap the repeat logic to reuse.

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.

2 participants