Implement LHv2 volume expansion#2673
Conversation
There was a problem hiding this comment.
Pull request overview
Adds end-to-end Robot Framework coverage for Longhorn v2 volume expansion (issue #2178), introduces a reusable storageclass component (CRD/REST layered like the other components), and reworks NVMe disk selection plus shared suite/test teardowns. As part of the change, the positional argument order of VM is created / vm.create(...) was swapped (image_id moved before cpu/memory) and the existing test_vm.robot caller was updated accordingly. The setting and blockdevice components are refactored from an env-var-driven strategy selector to a CRD-first / REST-fallback pattern via NotImplementedError.
Changes:
- New
test_longhorn_v2.robotflow covering provisioning, SC creation, VM-with-LHv2-volume, volume expansion (PVC-direct and VM-annotation-based), with NVMe disk picker and tag-based disk selector. - New
libs/storageclass/component +vm.update_disk_size/volumekeyword resource for expansion, plus Longhorn-node disk tag helpers inhost. - API-shape change:
vm.create(...)signature reordered to(vm_name, image_id, cpu, memory, **kwargs);volume get_statusrenamesstate→phaseand addsconditions.
Reviewed changes
Copilot reviewed 37 out of 37 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| harvester_robot_tests/tests/regression/test_longhorn_v2.robot | New LHv2 provisioning/expansion test flow and suite setup/teardown. |
| harvester_robot_tests/tests/regression/test_vm.robot | Updates caller to new VM is created positional arg order. |
| harvester_robot_tests/libs/vm/{base,vm,rest,crd}.py | Reorders create(...) args; adds update_disk_size + extra-disk support in CRD VM spec. |
| harvester_robot_tests/libs/volume/crd.py | Returns phase/conditions from get_status (renames state). |
| harvester_robot_tests/libs/storageclass/{init,base,crd,rest,storageclass}.py | New StorageClass component with CRD-first/REST-fallback pattern. |
| harvester_robot_tests/libs/setting/{base,crd,rest,setting}.py | Refactors to CRD-first/REST-fallback via NotImplementedError. |
| harvester_robot_tests/libs/blockdevice/{base,crd,rest,blockdevice}.py | Same CRD-first/REST-fallback refactor. |
| harvester_robot_tests/libs/host/{base,crd,host,rest}.py | Adds add/remove_lh_node_disk_tag and switches to CRD-first/REST-fallback base. |
| harvester_robot_tests/libs/keywords/{vm,volume,storage,host,common}_keywords.py | Exposes new component operations and get_timestamp. |
| harvester_robot_tests/libs/utility/utility.py | Adds get_timestamp helper. |
| harvester_robot_tests/keywords/{volume,virtualmachine,storage,image,host,common,variables}.resource | New volume keywords, refactored storage/SC keywords, NVMe disk picker, Common Suite/Test Teardown, env-overridable WAIT_TIMEOUT. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ec4fdda to
dcf6947
Compare
dcf6947 to
68d5327
Compare
khushboo-rancher
left a comment
There was a problem hiding this comment.
Thanks @albinsun for the PR, looks good. Few comments.
68d5327 to
d90c2df
Compare
khushboo-rancher
left a comment
There was a problem hiding this comment.
Looks good, few minor comments
| setting.LHv2 Data Engine Is Disabled | ||
| setting.Enable LHv2 Data Engine |
There was a problem hiding this comment.
If the LHv2 already enabled, how is it handled? Will it fail at 'setting.LHv2 Data Engine Is Disabled'?
Should we handle this while enabling of v2 data engine, if already enabled -> pass otherwise enable?
| *** Settings *** | ||
| Documentation Longhorn V2 Data Engine Test Cases | ||
| Test Tags longhorn LHv2 LonghornV2 storage experimental | ||
| Test Tags longhorn lhv2 experimental |
There was a problem hiding this comment.
IMO, let's keep the 'storage' tag. storage is the group where we can keep all the storage related test cases like v2, lvm etc
|
|
||
| *** Test Cases *** | ||
| Provision LHv2 Storages | ||
| [Tags] p1 |
There was a problem hiding this comment.
This, Create LHv2 Storage Class & Create VM With LHv2 Volume should be P0. Other tests like Expand LHv2 Volume Size should be P1.
We can follow below guideline:
P0: The core "happy path" or main workflow of the feature.
Impact: If this fails, the feature is completely unusable, and there is no workaround.
P1: Secondary paths, edge cases, or essential supporting functionality.
Impact: The core feature works, but key high-value additions or sub-features are broken.
P2: "Nice-to-have" features, or rarely used workflows.
Impact: Low user impact; the core value of the feature remains fully intact.
Signed-off-by: Albin Sun <albin.sun@suse.com>
d90c2df to
60cfed6
Compare


Which issue(s) this PR fixes:
What this PR does / why we need it:
Feature
Enhancement
blockdeviceandsettingcomponentsstorageclassCommon Suite/Test TeardownVM is createdFix
common_keywords.cleanup_volumesinCleanup test resourcesSpecial notes for your reviewer:
Additional documentation or context
Verification
Why Use NVMe disk instead of just large disks, NVMe vs. SAS
NVMe
2026-05-29.12.23.25.mov
SAS
2026-05-29.09.38.17.mov