Add support for increased block storage volume limits#757
Conversation
There was a problem hiding this comment.
Pull request overview
This PR expands the Linode Instance module’s configuration device mapping from 8 slots (sda–sdh) up to 64 slots (up to sdbl), and adds logic intended to avoid passing unintended null devices while also enforcing a per-instance-type device limit derived from RAM.
Changes:
- Add
generate_device_suffixes()helper to produce the expanded device suffix set (64 total). - Update the instance module’s device schema and config creation logic to use the expanded suffix set and enforce a calculated device limit.
- Add a unit test for suffix generation and a new integration test target for validating volume attachment limits.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
plugins/module_utils/linode_helper.py |
Adds a constant and helper to generate supported device suffixes up to 64. |
plugins/modules/instance.py |
Expands device spec keys to 64 and adds device reconciliation/limit enforcement before config creation. |
tests/unit/module_utils/test_linode_helper.py |
Adds a unit test validating the generated suffix list. |
tests/integration/targets/instance_volumes_limit/tasks/main.yaml |
New integration test validating attachment up to a limit and failure beyond it. |
docs/modules/instance.md |
Documents the expanded set of device keys in the module docs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tests/integration/targets/instance_volumes_limit/tasks/main.yaml
Outdated
Show resolved
Hide resolved
tests/integration/targets/instance_volumes_limit/tasks/main.yaml
Outdated
Show resolved
Hide resolved
yec-akamai
left a comment
There was a problem hiding this comment.
When running the integration test locally, it failed at Create a Linode instance with 16 volumes: /linode_api4/objects/linode.py\", line 1307, in config_create\n device_map[device_names[i]] = {\"volume_id\": d.id}\n ~~~~~~~~~~~~^^^\n\nIndexError: list index out of range\n"
📝 Description
This PR adds support for configuring up to 64 devices (volumes/disks) per Linode Instance Configuration, depending on the Linode's RAM.
Previously you could define 8 slots:
sda-sdh.Now you can define
sda-sdz,sdaa-sdazandsdba-sdbl.There was also a bug in the logic, when if you have skipped consecutive device from configuration, it was added anyway as a
Nullobject.✔️ How to Test
In order to utilize the logic for increased block storage volume limits, make sure to use
proj/block-storage-volume-limit-increasebranch insidelinode_api4-pythonrepository. (I have used:pip install -e .)To run unit tests (1 new unit test case):
make test-unitTo run Integration tests:
make integration-test TEST_SUITE=instance_volumes_limit