Skip to content

tests(storage): add LvmHotAddSuite for hot-add + LVM pvcreate stress - #4674

Open
rabdulfaizy wants to merge 1 commit into
mainfrom
rabd/lvm
Open

tests(storage): add LvmHotAddSuite for hot-add + LVM pvcreate stress#4674
rabdulfaizy wants to merge 1 commit into
mainfrom
rabd/lvm

Conversation

@rabdulfaizy

@rabdulfaizy rabdulfaizy commented Aug 15, 2026

Copy link
Copy Markdown
Member

Description

Adds a new functional storage suite, LvmHotAddSuite, that stresses hot-add of data disks followed by LVM pvcreate to reproduce a class of NVMe-VF initialization failures where the guest kernel logs:

nvme nvmeN: Identify NS List failed (status=0xb)

on a freshly attached namespace, leaving pvcreate to fail with Error reading device ... and lsblk to report the affected devices with size 0.

The suite covers four permutations:

Test case Priority Mode
verify_hot_add_disks_pvcreate_parallel_standard_ssd 1 parallel
verify_hot_add_disks_pvcreate_parallel_premium_ssd 1 parallel
verify_hot_add_disks_pvcreate_serial_standard_ssd 2 serial
verify_hot_add_disks_pvcreate_serial_premium_ssd 2 serial

Each variant snapshots lsblk, performs the hot-add, runs fdisk -l, runs pvcreate, re-snapshots lsblk to confirm the devices did not collapse to size 0, and scans dmesg for the Identify-family bad-status codes (0xb / 0x2 / 0xa) associated with NVMe 1.4 CNS=02h / CNS=03h. Cleanup always runs pvremove and detaches every attached data disk.

Mode differences

  • Parallel — hot-adds every free LUN up to max_data_disk_count in one call, then runs a single bulk pvcreate a b c ... so LVM opens every device in one syscall burst. This is the primary repro path — the burst of NS-Changed AENs floods udev before pvcreate opens the devices.
  • Serial — adds one LUN at a time and issues a per-device pvcreate <dev> loop so each device gets its own exit code / stderr. Baseline that should almost always pass; useful for isolating which disk fails.

Design notes

  • The dmesg Identify-failed scan is informational only (logged as a warning). Some guest kernels (e.g. Ubuntu 24) print the fingerprint at boot but recover via retry and complete the workload. PASS/FAIL is decided purely by the functional gates: hot-add enumeration in lsblk, fdisk -l listing, pvcreate exit 0, and post-pvcreate lsblk zero-size / missing-device check.
  • Uses simple_requirement(disk=Disk*SSDLRS(max_data_disk_count=IntRange(min=1))) so it filters at capability level and leaves all LUNs free for the hot-add burst — using data_disk_count would burn LUN 0..N-1 with placeholder disks at deploy time and shrink the burst.
  • Adds an optional max_disks_to_add variable (read from variables) to cap the hot-add burst below max_data_disk_count for targeted triage. Unset or 0 keeps the full-burst behaviour (highest fidelity repro).

Related Issue

None.

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_hot_add_disks_pvcreate_serial_premium_ssd|verify_hot_add_disks_pvcreate_parallel_premium_ssd|verify_hot_add_disks_pvcreate_serial_standard_ssd|verify_hot_add_disks_pvcreate_parallel_standard_ssd

Impacted LISA Features:

Disk, DiskPremiumSSDLRS, DiskStandardSSDLRS

Tested Azure Marketplace Images:

  • canonical ubuntu-24_04-lts server latest
  • suse sles-15-sp7 gen2 latest

Test Results

All matrix cells validated with max_disks_to_add=5 (runbook cap; native max_data_disk_count per SKU noted for reference). Every cell passes both the standard-SSD and premium-SSD variants — no nvme <ctrl>: Identify ... failed messages were observed in dmesg on any cell.

Image VM Size Native max data disks Mode standard_ssd premium_ssd Wall (sec)
canonical ubuntu-24_04-lts server latest Standard_D8as_v5 16 parallel (bulk pvcreate) PASSED PASSED 984
canonical ubuntu-24_04-lts server latest Standard_D8ads_v5 16 serial (per-device pvcreate) PASSED PASSED 1094
canonical ubuntu-24_04-lts server latest Standard_D8s_v6 24 serial (per-device pvcreate) PASSED PASSED 1102
canonical ubuntu-24_04-lts server latest Standard_D8ds_v6 24 parallel (bulk pvcreate) PASSED PASSED 891
suse sles-15-sp7 gen2 latest Standard_E8s_v7 32 serial (per-device pvcreate) PASSED PASSED 1295
suse sles-15-sp7 gen2 latest Standard_E8ds_v7 32 parallel (bulk pvcreate) PASSED PASSED 1061

Total: 12 / 12 test cases PASSED across 6 SKU/mode combinations spanning three VM generations (v5, v6, v7), both AMD (D*a*_v5) and Intel (D*_v6, E*_v7) platforms, and two guest distros (Ubuntu 24.04, SLES 15 SP7). Both storage attach paths are exercised: SCSI (/dev/sd*) on v5 and NVMe (/dev/nvme0n*) on v6/v7. Runbook cap max_disks_to_add=5 is honored on every SKU (native caps 16/24/32 → 5).

Individual test durations range from 152 sec (parallel, premium) to 355 sec (serial, premium); wall time per config also includes deployment and cleanup.

Copilot AI lite review requested due to automatic review settings August 15, 2026 03:36

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

Adds a new functional storage test suite (LvmHotAddSuite) under testsuites/storage to stress Azure data-disk hot-add followed by LVM pvcreate, aiming to reproduce/observe NVMe namespace initialization failures (including “Identify … failed” patterns) while gating PASS/FAIL on functional disk usability.

Changes:

  • Introduces LvmHotAddSuite with 4 test variants (parallel/serial × StandardSSD/PremiumSSD) using simple_requirement(... max_data_disk_count=IntRange(min=1)) to preserve all free LUNs for the hot-add burst.
  • Implements hot-add enumeration + fdisk -l + pvcreate gates, plus a post-pvcreate lsblk check for missing/zero-sized devices.
  • Adds dmesg scanning for NVMe Identify-failure fingerprints as informational warnings.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lisa/microsoft/testsuites/storage/lvm_hot_add.py Outdated
Comment thread lisa/microsoft/testsuites/storage/lvm_hot_add.py Outdated
Comment on lines +415 to +416
timeout=60,
interval=2,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done in 2680b46 - promoted to _HOT_ADD_LSBLK_POLL_TIMEOUT = 60 and _HOT_ADD_LSBLK_POLL_INTERVAL = 2 class constants with inline rationale explaining why these values were chosen (max_data_disk_count fanout + typical udev settle time), so future tuning is intentional and reviewable.

Comment thread lisa/microsoft/testsuites/storage/lvm_hot_add.py Outdated
@LiliDeng

Copy link
Copy Markdown
Collaborator

AI Test Case Selection

Selected 3 test case(s): verify_dm_cache_setup,verify_disk_with_nobarrier,verify_disk_with_fio_verify_option

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

Result: Succeeded

View full logs in Azure DevOps

Copilot AI review requested due to automatic review settings August 15, 2026 17:59

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Suppressed comments (2)

lisa/microsoft/testsuites/storage/lvm_hot_add.py:390

  • The cleanup path catches a broad Exception around pvremove.remove_pv(..., ignore_errors=True). Since ignore_errors=True already suppresses non-zero exit codes, the remaining expected failure mode is typically a LISA-level execution problem (e.g. command timeout) which raises LisaException. Narrowing the exception type avoids hiding unexpected programming errors while still keeping cleanup best-effort.
                try:
                    pvremove.remove_pv(*new_device_paths, ignore_errors=True)
                except Exception as ex:  # noqa: BLE001
                    log.warning(f"pvremove cleanup raised: {ex}")

lisa/microsoft/testsuites/storage/lvm_hot_add.py:256

  • max_disks_to_add is parsed with int(...) directly, so a non-numeric value (e.g. a typo in the runbook variable) will raise ValueError without a clear, actionable message. Please validate and fail with a helpful error that shows the received value and an example of the correct -v max_disks_to_add:<N> usage.
        requested_cap = int(variables.get("max_disks_to_add", 0) or 0)

@LiliDeng

Copy link
Copy Markdown
Collaborator

AI Test Case Selection

Selected 3 test case(s): verify_dm_cache_setup,verify_disk_with_nobarrier,verify_disk_with_fio_verify_option

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

Result: Succeeded

View full logs in Azure DevOps

@LiliDeng

Copy link
Copy Markdown
Collaborator

AI Test Case Selection

Selected 3 test case(s): verify_dm_cache_setup,verify_disk_with_nobarrier,verify_disk_with_fio_verify_option

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

Result: Succeeded

View full logs in Azure DevOps

… LVM

Adds a new functional storage suite that stresses hot-add of data disks
followed by LVM pvcreate to reproduce a class of host-side NVMe VF
initialization failures where the guest kernel logs

    nvme nvmeN: Identify NS List failed (status=0xb)

on the newly attached namespace, leaving pvcreate to fail with
'Error reading device ...' and lsblk to report the affected devices
with size 0. The suite covers four permutations:

  - verify_hot_add_disks_pvcreate_parallel_standard_ssd  (P1)
  - verify_hot_add_disks_pvcreate_parallel_premium_ssd   (P1)
  - verify_hot_add_disks_pvcreate_serial_standard_ssd    (P2)
  - verify_hot_add_disks_pvcreate_serial_premium_ssd     (P2)

Parallel mode hot-adds every free LUN up to max_data_disk_count in a
single call and then runs a single-shot pvcreate on all newly attached
devices - this is the primary repro variant since the burst of
NS-Changed AENs floods udev before pvcreate opens the devices.
Serial mode adds one LUN at a time and is a baseline that should
almost always pass.

Each variant snapshots lsblk, performs the hot-add, runs 'fdisk -l',
runs pvcreate, re-snapshots lsblk to confirm the devices did not
collapse to size 0, and scans dmesg for the Identify-family bad-status
codes (0xb / 0x2 / 0xa) associated with the NVMe 1.4 CNS=02h / CNS=03h
spec violations. Cleanup always runs pvremove and detaches all
attached data disks.

Supports an optional 'max_disks_to_add' runbook variable to cap the
hot-add burst below max_data_disk_count for targeted triage; unset or
0 keeps the full-burst behaviour (highest fidelity repro).
Copilot AI review requested due to automatic review settings August 15, 2026 23:35

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Suppressed comments (5)

lisa/microsoft/testsuites/storage/lvm_hot_add.py:399

  • Avoid catching broad Exception here; prefer a narrower set (e.g. LisaException / AssertionError) so unexpected programming errors are not masked. This also keeps the 'BadEnvironmentStateException' path focused on expected detach failures.
                try:
                    disk.remove_data_disk(disks_added)
                except Exception as ex:  # noqa: BLE001
                    # A failed detach can leak Azure managed disks and
                    # leave the environment in an unknown state. Raise
                    # BadEnvironmentStateException so LISA recycles the
                    # environment instead of handing a partially-cleaned
                    # node to the next test.
                    raise BadEnvironmentStateException(
                        f"remove_data_disk cleanup failed for {disks_added}: {ex}"
                    ) from ex

lisa/microsoft/testsuites/storage/lvm_hot_add.py:53

  • _DATA_DISK_SIZE_IN_GB and _DEFAULT_TIMEOUT are test-behavior knobs; add a brief inline rationale so future tuning is intentional and reviewable (per LISA guidelines on magic numbers).
    _DATA_DISK_SIZE_IN_GB = 10
    _DEFAULT_TIMEOUT = 3600

lisa/microsoft/testsuites/storage/lvm_hot_add.py:459

  • The f-string passed to check_till_timeout is evaluated immediately, so if the wait times out the raised message will always show the initial empty state (not the final lsblk state). Consider catching LisaTimeoutException and re-raising with the dynamically captured state for accurate diagnostics.
        check_till_timeout(
            _check,
            timeout_message=(
                f"expected {expected_count} new disk(s) in lsblk after "
                f"hot-add, found {len(state['added'])}: "
                f"{[d.name for d in state['added']]}"
            ),

lisa/microsoft/testsuites/storage/lvm_hot_add.py:253

  • Parsing max_disks_to_add via int(...) can raise ValueError/TypeError and fail the test with a less actionable traceback when the runbook variable is malformed. Raise a LisaException with the invalid value to make this easier to diagnose.
        requested_cap = int(variables.get("max_disks_to_add", 0) or 0)
        if 0 < requested_cap < len(free_luns):

lisa/microsoft/testsuites/storage/lvm_hot_add.py:386

  • Avoid catching broad Exception in cleanup paths. Catch the specific exception types expected from tool execution so genuine programming errors still surface.

This issue also appears on line 389 of the same file.

                try:
                    pvremove.remove_pv(*new_device_paths, ignore_errors=True)
                except Exception as ex:  # noqa: BLE001
                    log.warning(f"pvremove cleanup raised: {ex}")

@LiliDeng

Copy link
Copy Markdown
Collaborator

AI Test Case Selection

Selected 3 test case(s): verify_dm_cache_setup,verify_disk_with_nobarrier,verify_disk_with_fio_verify_option

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

Result: Succeeded

View full logs in Azure DevOps

@rabdulfaizy
rabdulfaizy marked this pull request as ready for review August 16, 2026 17:30
@LiliDeng

Copy link
Copy Markdown
Collaborator

AI Test Case Selection

Selected 3 test case(s): verify_dm_cache_setup,verify_disk_with_nobarrier,verify_disk_with_fio_verify_option

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

Result: Succeeded

View full logs in Azure DevOps

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.

3 participants