Skip to content

[AI Generated] BugFix: Use platform capability disk_count instead of vCPU/8 formula for NVMe count validation#4440

Merged
knelsonmeister merged 1 commit into
mainfrom
bugfix/nvme-basic-skip-vcpu8-non-direct_210426_213605
May 13, 2026
Merged

[AI Generated] BugFix: Use platform capability disk_count instead of vCPU/8 formula for NVMe count validation#4440
knelsonmeister merged 1 commit into
mainfrom
bugfix/nvme-basic-skip-vcpu8-non-direct_210426_213605

Conversation

@knelsonmeister
Copy link
Copy Markdown
Collaborator

Summary

The verify_nvme_basic test (step 4 of _verify_nvme_disk) unconditionally asserted that the NVMe namespace count equals ceil(vCPU / 8). This formula only applies to storage-optimized (L-series) VMs with NVMe Direct disks, but was applied to all Azure VMs — causing false failures on VMs like Standard_D4ds_v6 / Standard_D64ds_v6 where NVMe is used for remote/temp disks with different counts.

The fix replaces the hardcoded vCPU/8 formula with the platform-derived NvmeSettings.disk_count capability, which Azure computes from NvmeDiskSizeInMiB / NvmeSizePerDiskInMiB in the SKU data. This is correct for all VM types.

Validation Results

VM Size Image Result
Standard_L8s_v3 Canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest PASSED
Standard_L80s_v3 Canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest PASSED
Standard_D4ds_v6 Canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest PASSED
Standard_D64ds_v6 Canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest PASSED
Standard_D2s_v3 Canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest SKIPPED (no NVMe — correct)

@github-actions
Copy link
Copy Markdown

✅ AI Test Selection — PASSED

7 test case(s) selected (view run)

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

Count
✅ Passed 7
❌ Failed 0
⏭️ Skipped 0
Total 7
Test case details
Test Case Status Time (s) Message
verify_nvme_manage_ns (lisa_0_4) ✅ PASSED 16.622
verify_nvme_sriov_rescind (lisa_0_6) ✅ PASSED 11.593
verify_nvme_function_unpartitioned (lisa_0_3) ✅ PASSED 28.129
verify_nvme_function (lisa_0_2) ✅ PASSED 27.749
verify_nvme_basic (lisa_0_0) ✅ PASSED 11.258
verify_nvme_rescind (lisa_0_5) ✅ PASSED 10.316
verify_nvme_max_disk (lisa_0_1) ✅ PASSED 7.933

@knelsonmeister
Copy link
Copy Markdown
Collaborator Author

@knelsonmeister please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree company="Microsoft"

@johnsongeorge-w
Copy link
Copy Markdown
Collaborator

@knelsonmeister can you check the CI failure?

@johnsongeorge-w johnsongeorge-w self-requested a review May 7, 2026 04:50
Copilot AI review requested due to automatic review settings May 13, 2026 18:43
@knelsonmeister knelsonmeister force-pushed the bugfix/nvme-basic-skip-vcpu8-non-direct_210426_213605 branch from 7e2270d to 531d78a Compare May 13, 2026 18:43
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

Replaces the hardcoded ceil(vCPU / 8) NVMe namespace count assertion in _verify_nvme_disk with a check against the platform-derived NvmeSettings.disk_count capability, which is correct for non-L-series Azure VMs that also expose NVMe (e.g., Dds_v6 series with remote/temp NVMe).

Changes:

  • Removed dependency on math and Lscpu for computing expected NVMe count.
  • Look up NvmeSettings from node.capability.features.items and assert len(nvme_namespace) == nvme_settings.disk_count.
  • Added defensive assertions that the capability is present and that disk_count is a concrete int.

@github-actions
Copy link
Copy Markdown

✅ AI Test Selection — PASSED

7 test case(s) selected (view run)

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

Count
✅ Passed 7
❌ Failed 0
⏭️ Skipped 0
Total 7
Test case details
Test Case Status Time (s) Message
verify_nvme_manage_ns (lisa_0_4) ✅ PASSED 22.290
verify_nvme_function_unpartitioned (lisa_0_3) ✅ PASSED 34.062
verify_nvme_sriov_rescind (lisa_0_6) ✅ PASSED 18.058
verify_nvme_function (lisa_0_2) ✅ PASSED 36.070
verify_nvme_rescind (lisa_0_5) ✅ PASSED 16.449
verify_nvme_basic (lisa_0_0) ✅ PASSED 15.391
verify_nvme_max_disk (lisa_0_1) ✅ PASSED 18.332

@knelsonmeister
Copy link
Copy Markdown
Collaborator Author

knelsonmeister commented May 13, 2026

Retested after the mypy fix (added assert node.capability.features before accessing .items):

VM Size Type Result
Standard_L8s_v3 NVMe Direct (storage-optimized) PASSED
Standard_D4ds_v6 NVMe remote disk (v6 family) PASSED

Both sizes pass on commit 531d78a.

@knelsonmeister knelsonmeister merged commit c9d95c5 into main May 13, 2026
65 checks passed
@knelsonmeister knelsonmeister deleted the bugfix/nvme-basic-skip-vcpu8-non-direct_210426_213605 branch May 13, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants