Skip to content

New extension: nvme-conversion — Convert VM disk controllers between SCSI and NVMe - #9858

Open
jonathanbrenes wants to merge 6 commits into
Azure:mainfrom
jonathanbrenes:feature/nvme-conversion
Open

jonathanbrenes wants to merge 6 commits into
Azure:mainfrom
jonathanbrenes:feature/nvme-conversion

Conversation

@jonathanbrenes

@jonathanbrenes jonathanbrenes commented May 11, 2026 •

Copy link
Copy Markdown
Contributor

New extension: nvme-conversion — Convert VM disk controllers between SCSI and NVMe


This checklist is used to make sure that common guidelines for a pull request are followed.

Related command

az nvme-conversion check, az nvme-conversion convert

Description

Adds a preview (1.0.0b1) extension for complete SCSI/NVMe conversion: VM/SKU/OS
validation, Linux or Windows preparation, disk capabilities, deallocation,
resize/controller update and optional restart. Linux dry-run remains supported.

VM-wide ADE exclusion follow-up

  • Refuse NVMe when ADE is present on the OS or any attached data disk.
  • Inspect Linux/Windows ADE handler types regardless of extension instance name
    or provisioning state, VM disk settings and every managed disk's ADE metadata.
  • Fail closed on API errors, incomplete inventory, unknown/residual encryption
    settings or inconsistent disk identities. Removing the extension or unlocking
    the volume does not prove that the disks are decrypted.
  • Apply this before guest preparation and controller/disk writes, including
    skip-check/dry-run invocations and already-NVMe checks.
  • Do not conflate SSE, server-side customer-managed keys or encryption at host
    with ADE. The NVMe exclusion does not prevent returning to SCSI.
  • Successful NVMe check output includes a versioned nvmeEligibility inventory
    for trusted offline recovery handoff to Add Linux NVMe preparation action ALAR#40. Failed/unknown ADE
    checks emit no eligibility object and stop before guest RunCommand.
  • Support both paged extension inventory and the installed CLI SDK's
    VirtualMachineExtensionsListResult.value response, verified read-only.

The trusted repair workflow must associate the full report with the actual
source VM/recovery disk and prevent configuration changes during preparation.
This is private workflow metadata, not signed Azure attestation. ALAR requires
a root-owned report no more than 15 minutes old; no Azure SDK is added to ALAR.

RHEL 7 EFI follow-up

Fixes the live-reproduced RHEL 7.9 false-readiness result where defaults contained
timeout 240 but the actual standalone EFI entries omitted it and NVMe used 30.
Resolve the guest EFI target, require one exact timeout token on every entry,
regenerate/verify that target and preserve defaults/idempotence/dry-run behavior.
Reject broken links, redirect stubs and failed/ineffective generation. Other
release/BIOS logic is unchanged. The shell correction itself does not change
encryption policy; the separate ADE gate above now enforces NVMe exclusion.
The 13 EFI tests remain self-contained chroot regressions.

CI service-registration follow-up

The earlier failed pipeline jobs lacked the nvme-conversion service-name entry.
The existing five-line Virtual Machines registration remains unchanged; no
new command names or index edits are introduced by this ADE update.

Validation

Canonical CLI Git tree: 21c43fef7da4efc36543123394af24b846883ae1.

Exact command/check Result
python -B -m pytest azext_nvme_conversion/tests/latest/test_nvme_conversion.py azext_nvme_conversion/tests/latest/test_linux_efi_timeout.py -q -p no:cacheprovider -k 'not NvmeConversionCheckTest and not NvmeConversionConvertTest' (extension root, Linux root) PASSED: 87 tests, 2 existing live scenarios deselected
azdev style nvme-conversion (existing virtualenv, private configuration pointing to the isolated worktree) PASSED: pylint and flake8
python scripts/ci/test_index.py -q PASSED: 9 tests, including 2 skips
python setup.py build --build-base <external-build-base> bdist_wheel --dist-dir <external-wheel-dir> --bdist-dir <external-bdist-dir> (extension root) PASSED; packaged production code matches canonical source byte-for-byte
git diff --cached --check; Python syntax and documentation PASSED
Real nvme-conversion check handler with --controller-type NVMe --ignore-os-check --ignore-sku-check --ignore-windows-version-check PASSED read-only on a retained VM; source-VM ADE inventory emitted and VM remains deallocated
External ALAR consumer contract suite PASSED: 13 cases, including actual Azure report consumption
Actual ALAR executable refusal cases PASSED: 18 cases before guest discovery or repairs

Local style setup needed its usual package metadata; no dependency installation
or global development/authentication changes were made. Canonical-source
validation exposed and corrected the extension-list response wrapper difference.
API 403 denial was reproduced against the preserved old helper and is no longer
treated as extension absence.

Current validation made no new VM deployments, guest RunCommand calls or Azure
resource mutations. No encrypted live VM conversion was attempted: ADE is now
explicitly rejected. The existing ALAR Rust unit test emits telemetry.

Earlier shared-shell/ALAR RHEL 7.9 validation remains historical: 37 units,
191 multi-mode fixtures and real SCSI/NVMe/reboot/rollback with timeout 240 passed.
Earlier native ARM64/plaintext Oracle results do not imply ADE compatibility.
Stable public SSH remains a separate unresolved category.

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally? (pip install wheel==0.30.0 required)
  • My extension version conforms to the Extension version schema

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.

…SCSI and NVMe

Adds the nvme-conversion extension that orchestrates the full SCSI<->NVMe
conversion lifecycle for Azure VMs:
- Pre-flight validation (Gen2, ADE, SKU capabilities, OS readiness)
- OS preparation via RunCommand (Windows stornvme, Linux initramfs/grub/fstab)
- VM deallocate, OS disk capability update, VM resize + controller change
- Optional VM start with rollback instructions

Commands:
  az nvme-conversion check   - Validate VM readiness without changes
  az nvme-conversion convert - Full conversion with --fix-os, --dry-run, --no-wait

Tested on: Ubuntu 24.04, RHEL 8/9/10, SLES 15 SP6, Azure Linux 4,
Windows Server 2019/2022 — 20 VMs, 56 unit tests, azdev style/test/linter passed.
- custom.py: reject unmanaged (page-blob) OS disks in _validate_vm with a clear ValidationError.

- custom.py: add _get_vm_skus() helper; share resource_skus.list() result between _resolve_vm_size and _validate_sku to avoid duplicate API calls.

- custom.py: switch user-progress logger.warning calls to logger.info (Gen2 banner, controller arrows, SKU validating, VM updated, VM started, etc.); reserve warnings for actual problems.

- custom.py: collapse _check_os_readiness into a thin wrapper around _prepare_os(fix_os=False, dry_run=False) to remove duplicated logic.

- custom.py: validate SKU capabilities across all vm.zones, not just vm.zones[0].

- _linux_checks.py / _windows_checks.py: add timeout=600 to begin_run_command(...).result() calls so RunCommand cannot hang indefinitely.

- commands.py: replace confirmation=True with a custom yes/no prompt that names the VM and target controller for the convert command.

- setup.py: pin azure-mgmt-compute>=30.0.0.

Validated end-to-end against live Azure VMs in westus3:

- 6/6 RHEL 9 LVM Gen2 VMs converted Standard_D2s_v5 (SCSI) -> Standard_D2s_v6 (NVMe) and verified post-conversion.

- Unmanaged-disk guard verified live: az nvme-conversion check on an unmanaged-disk VM fails with the new clear error message.

- pytest: 56 passed, 2 skipped. azdev style (pylint + flake8): PASSED.
Copilot AI review requested due to automatic review settings May 11, 2026 21:36
@azure-client-tools-bot-prd

Copy link
Copy Markdown
Validation for Breaking Change Starting...

Thanks for your contribution!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a new Azure CLI extension (nvme-conversion) to pre-flight check and convert Azure VM disk controllers between SCSI and NVMe, including OS readiness checks/fixes and user-facing help/output.

Changes:

  • Introduces az nvme-conversion check and az nvme-conversion convert commands with SKU/ADE/Gen2/power-state validation and conversion orchestration.
  • Adds OS preparation implementations for Linux (embedded RunCommand bash script) and Windows (stornvme checks/fix via RunCommand).
  • Adds unit + mocked end-to-end tests plus extension packaging metadata and docs.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
src/nvme-conversion/setup.py Extension packaging metadata and dependencies
src/nvme-conversion/setup.cfg Placeholder config file
src/nvme-conversion/azext_nvme_conversion/custom.py Primary check/convert orchestration and internal helpers
src/nvme-conversion/azext_nvme_conversion/commands.py CLI command registration + confirmation/table formatting wiring
src/nvme-conversion/azext_nvme_conversion/_params.py CLI parameters and validators wiring
src/nvme-conversion/azext_nvme_conversion/_validators.py Input validation for --vm-size and --sleep-seconds
src/nvme-conversion/azext_nvme_conversion/_windows_checks.py Windows RunCommand checks/fix + version validation
src/nvme-conversion/azext_nvme_conversion/_linux_checks.py Linux RunCommand wrapper and error parsing
src/nvme-conversion/azext_nvme_conversion/_linux_script.py Embedded bash script for Linux NVMe readiness + fixes
src/nvme-conversion/azext_nvme_conversion/_format.py Table output transformers for -o table
src/nvme-conversion/azext_nvme_conversion/_help.py Help text and examples
src/nvme-conversion/azext_nvme_conversion/_client_factory.py Compute client factory
src/nvme-conversion/azext_nvme_conversion/azext_metadata.json Extension metadata (preview + min CLI core)
src/nvme-conversion/azext_nvme_conversion/tests/latest/test_nvme_conversion.py Unit + mocked end-to-end tests
src/nvme-conversion/README.md User-facing overview and usage
src/nvme-conversion/HISTORY.rst Initial release notes
src/nvme-conversion/DEVELOPMENT.md Development guide and architecture notes
src/nvme-conversion/ROADMAP.md Implementation roadmap and design notes
src/nvme-conversion/TESTING.md Live test tracker

Comment on lines +245 to +247
# Windows version
if os_type == 'Windows' and not ignore_windows_version_check:
_status('[5/7] Checking Windows version...')

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in b9e5df3. Renumbered to [5/7] for Windows version check and [6/7] for SKU validation.

Comment thread src/nvme-conversion/setup.py Resolved
Comment thread src/nvme-conversion/setup.py Resolved
Comment thread src/nvme-conversion/TESTING.md Resolved
@yonzhan

Copy link
Copy Markdown
Collaborator

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions

Copy link
Copy Markdown
Contributor

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

@github-actions

Copy link
Copy Markdown
Contributor

jonathanbrenes and others added 3 commits May 11, 2026 17:00
Validate and regenerate the resolved RHEL 7 standalone EFI boot entries instead of accepting timeout defaults from an unrelated configuration. Add isolated shell regressions and document runtime validation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add the top-level nvme-conversion command to the service mapping required by Azure Pipelines style and linter validation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Verify ADE handlers and OS/all data-disk encryption metadata before NVMe
preparation or writes. Refuse incomplete inventory and API failures without
blocking SSE, encryption at host or a return to SCSI.

Emit versioned source-VM eligibility for trusted offline ALAR handoff, with
mocked regressions and actual SDK response-wrapper compatibility coverage.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

4 participants