Skip to content

nvme basic test fix for disk count match#4437

Draft
kanchansenlaskar wants to merge 1 commit intomainfrom
kasenlaskar/nvme_basic_test_fix
Draft

nvme basic test fix for disk count match#4437
kanchansenlaskar wants to merge 1 commit intomainfrom
kasenlaskar/nvme_basic_test_fix

Conversation

@kanchansenlaskar
Copy link
Copy Markdown
Collaborator

@kanchansenlaskar kanchansenlaskar commented Apr 26, 2026

Description

Replaced import math with from typing import cast (math is no longer needed).

Replaced the hardcoded vCPU/8 formula in _verify_nvme_disk() step 4 with a query to the Azure SKU capabilities:

Before: expected_count = math.ceil(thread_count / 8)
After: expected_count = cast(NvmeSettings, node.features[Nvme].get_settings()).disk_count
The Azure platform already computes the correct NVMe disk count from NvmeDiskSizeInMiB // NvmeSizePerDiskInMiB in the SKU capabilities and stores it in NvmeSettings.disk_count. This is the authoritative source for expected disk count and works correctly across all VM families (including v6-series with different NVMe-to-vCPU ratios).

Improved the assertion message to include the actual expected count and its source for easier debugging.

Related Issue

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring
  • Documentation update

Checklist

  • Description is filled in above
  • No credentials, secrets, or internal details are included
  • Peer review requested (if not, add required peer reviewers after raising PR)
  • Tests executed and results posted below

Test Validation

Key Test Cases:
verify_nvme_basic

Impacted LISA Features:

Tested Azure Marketplace Images:

Test Results

Image VM Size Result
PASSED / FAILED / SKIPPED

Copilot AI review requested due to automatic review settings April 26, 2026 13:02
Copy link
Copy Markdown
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

Updates the NVMe test suite to validate Azure NVMe disk counts using Azure SKU capabilities (via NvmeSettings.disk_count) instead of a hardcoded vCPU-based heuristic, improving correctness across VM families.

Changes:

  • Replace the vCPU/8-based expected NVMe count logic with NvmeSettings.disk_count from feature settings.
  • Remove unused math/Lscpu usage and update related test descriptions/messages.

# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import math
from typing import cast
Copy link

Copilot AI Apr 26, 2026

Choose a reason for hiding this comment

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

The PR description content appears to be entirely inside an HTML comment in the PR template, so reviewers won’t see the rationale or the before/after behavior. Please add a visible description explaining what this PR changes and why.

Copilot uses AI. Check for mistakes.
Comment on lines 68 to +69
4. Azure platform only, nvme devices count should equal to
actual vCPU count / 8.
expected disk count from SKU capabilities.
Copy link

Copilot AI Apr 26, 2026

Choose a reason for hiding this comment

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

This step says "nvme devices count" but the implementation uses the namespace list length as the count being asserted later. Please clarify the wording to refer to namespaces/disks (e.g., /dev/nvme*n*) to avoid confusion about controller vs namespace counts.

Copilot uses AI. Check for mistakes.
Comment on lines 416 to +417
# 4. Azure platform only, nvme devices count should equal to
# actual vCPU count / 8.
# expected disk count from SKU capabilities.
Copy link

Copilot AI Apr 26, 2026

Choose a reason for hiding this comment

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

This comment says "nvme devices count" but the assertion below is on the NVMe namespaces list length. Please update the comment to match what’s being checked (namespaces/disks vs controllers/devices).

Copilot uses AI. Check for mistakes.
expected_count = nvme_settings.disk_count
assert_that(nvme_namespace).described_as(
"nvme devices count should be equal to [vCPU/8]."
f"nvme devices count should be equal to expected disk count"
Copy link

Copilot AI Apr 26, 2026

Choose a reason for hiding this comment

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

The assertion is checking nvme_namespace length, but the described_as message says "nvme devices count". Please align the message with the actual subject being asserted (namespaces/disks), so failures are easier to interpret.

Suggested change
f"nvme devices count should be equal to expected disk count"
f"nvme namespace count should be equal to expected disk count"

Copilot uses AI. Check for mistakes.
@kanchansenlaskar kanchansenlaskar changed the title nvme basic test fix for vcpu count match nvme basic test fix for disk count match Apr 26, 2026
@github-actions
Copy link
Copy Markdown

✅ AI Test Selection — PASSED

5 test case(s) selected (view run)

Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest

Count
✅ Passed 5
❌ Failed 0
⏭️ Skipped 0
Total 5
Test case details
Test Case Status Time (s) Message
verify_nvme_rescind (lisa_0_4) ✅ PASSED 11.964
verify_nvme_basic (lisa_0_0) ✅ PASSED 9.176
verify_nvme_function_unpartitioned (lisa_0_3) ✅ PASSED 28.808
verify_nvme_function (lisa_0_2) ✅ PASSED 29.738
verify_nvme_max_disk (lisa_0_1) ✅ PASSED 9.615

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