Skip to content

vm-repair scripts: fix resource-disk exclusion and add Linux NVMe readiness detection - #145

Merged
Edwin Bernal Microsoft (EdwinBernal1) merged 2 commits into
mainfrom
nvme-followup
Sep 9, 2026
Merged

vm-repair scripts: fix resource-disk exclusion and add Linux NVMe readiness detection#145
Edwin Bernal Microsoft (EdwinBernal1) merged 2 commits into
mainfrom
nvme-followup

Conversation

@EdwinBernal1

@EdwinBernal1 Edwin Bernal Microsoft (EdwinBernal1) commented Sep 8, 2026

Copy link
Copy Markdown
Member

Summary

Fixes Azure resource-disk exclusion in the NVMe-aware Windows disk-discovery helper and adds a read-only Linux detector for SCSI-to-NVMe boot readiness.

The resource disk is reported as SAS on current Azure repair VMs, not the literal SCSI, and PowerShell 5.1 returns a scalar for a single partition. The old check therefore treated the temporary resource disk as a repair target. The fix recognizes the SCSI-family bus types and array-wraps partition results before counting them.

The new linux-detect-nvme-readiness run-id mounts the attached root filesystem read-only and reports unstable device references, NVMe-driver presence in the newest initramfs, dracut host-only configuration, distro identity, attached-disk transports, and one machine-readable [NVME-EVIDENCE-JSON] record. It does not modify the attached OS disk.

Requested by / source

  • Feature 37971694
  • Requested by Bila / Gabriela Limoli
  • Companion planning: NVMe-PR-Scripts.md

Type

  • Bug fix
  • Feature
  • Breaking change
  • Documentation only

Changes

  • src/windows/common/helpers/Get-Disk-Partitions-v3.ps1
    • Recognizes SCSI, SAS, and RAID as the SCSI family when excluding the Azure resource disk.
    • Array-wraps Get-Partition output before counting it.
    • Reports the correct partition count in the warning path.
  • tests/test-get-disk-partitions-v3.ps1
    • Adds a standalone regression test for a SAS resource disk represented by a scalar partition result.
    • Confirms the attached OS disk remains a repair target.
  • src/linux/linux-detect-nvme-readiness.sh
    • Adds read-only Linux NVMe-readiness detection and structured evidence output.
    • Guards expected nonzero commands for the run driver's bash -e behavior.
    • Ensures mounted filesystems are cleaned up on exit.
    • Escapes guest-controlled values before writing evidence JSON.
  • map.json
    • Registers the new permanent run-id linux-detect-nvme-readiness.

Version & changelog

  • Not applicable: this PR changes repair-script-library, not the versioned Azure CLI extension package.

Testing

Completed locally

  • Branch created from latest origin/main (0df7fa7, merge of PR vm-repair scripts: add read-only win-detect-nvme-readiness detection script #144)
  • Regression test fails against pre-fix origin/main: resource disk is returned and the test finds two targets
  • Regression test passes with this fix: SAS resource disk is excluded and OS partition F: remains
  • git diff --check origin/main...HEAD
  • Git Bash syntax check: bash -n src/linux/linux-detect-nvme-readiness.sh
  • map.json parses
  • All 28 run-ids are unique
  • Every mapped script path exists
  • PSScriptAnalyzer — unavailable in the current environment

Cross-repo impact

  • Adds one public repair-script run-id: linux-detect-nvme-readiness.
  • No Azure CLI extension code change is required for run-id discovery because list-scripts reads map.json.
  • Companion extension work is tracked separately in NVMe-PR-Extension.md.
  • Decision on overlap with repair-script-library PR Add the offline repair foundation helpers (1 of 3) #143 remains to be recorded before R1 implementation begins.

Security review

  • The Linux detector mounts the attached root filesystem with -o ro and contains no write operation against that filesystem.
  • Cleanup is registered with an exit trap so unexpected failures do not intentionally leave the root filesystem mounted.
  • Guest-controlled evidence values are JSON-escaped before serialization.
  • Device overrides and discovered paths are quoted at command boundaries.
  • No eval, bash -c, sh -c, command construction from untrusted input, credential logging, secrets, or customer data were introduced.

Backward compatibility

  • Existing run-ids and scripts are unchanged.
  • Existing v1/v2 disk helpers and their callers are untouched.
  • The v3 fix narrows results only by correctly removing the documented Azure temporary resource disk.
  • linux-detect-nvme-readiness is additive and read-only.

@EdwinBernal1
Edwin Bernal Microsoft (EdwinBernal1) merged commit a01c7d4 into main Sep 9, 2026
1 check passed
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