Repository navigation
feat: add FlexGroup create support to create_volume #215
Description
Context
create_volume today always maps a single aggregate_name and never sets style or FlexGroup placement fields. Agents cannot create a FlexGroup through the typed tool and have to drop to REST.
ONTAP uses one POST /api/storage/volumes catalog for every personality. GET /api/cluster disaggregated and san_optimized change what that POST means. This proposal extends create_volume for Unified NAS FlexGroups and fails closed on personalities where that body is wrong, instead of sending a Unified FlexGroup payload at the wrong cluster.
Related: #189 (AFX volume create requires omitting aggregates / using constituent_count). This issue does not implement that AFX success path.
I plan to open a pull request for this.
Gap
create_volume cannot express:
style=flexgroup- multiple aggregates
constituents_per_aggregateoptimize_aggregates(CLIoptimize-aggr-list)- granular data mode (
disabled/basic/advanced)
aggregate_name is also schema-required, so a FlexGroup call cannot omit the singular field.
Proposal
Extend tool.VolumeCreate only (not update_volume):
style—flexvol(default) orflexgroup. Rejectflexgroup_constituent.aggregate_names— required whenstyle=flexgroup.constituents_per_aggregate— optional on FlexGroup (ONTAP defaults to 4 when multiple aggregates are given).optimize_aggr_list— optional bool, default false (same as REST). Omit RESToptimize_aggregatesunless the agent sets true.granular_data—disabled(default),basic, oradvanced. Maps to RESTgranular_data+granular_data_mode. Omit both REST fields when disabled.
Make aggregate_name schema-optional (omitzero) and enforce in newCreateVolume:
- Cannot set both
aggregate_nameandaggregate_names. - FlexVol:
aggregate_namerequired; reject FlexGroup-only fields. - FlexGroup:
aggregate_namesrequired (len >= 1). Do not infer FlexGroup from a multi-name list ifstyleis omitted. Do not allow FlexGroup with no aggregates (UDO auto-provision).
Existing fields (size, nas.path, guarantee.type, efficiency, QoS, snapshot policy) stay as they are.
create_volume will read cluster disaggregated / san_optimized (already fetched in GetClusterInfo) and apply these gates before building the REST body:
- Unified NAS (AFF/FAS): FlexVol and FlexGroup as above.
- Classic ASA (
san_optimized, not disaggregated): FlexVol allowed; FlexGroup refused (ONTAP13107413). - AFX (disaggregated, not SAN-optimized): FlexGroup fields refused (placement omits aggregates; see volume provisioning in AFX cluster failed with error #189).
- ASA r2 (both flags):
create_volumerefused; provision a storage unit instead.
Out of scope
- AFX auto-placement (
constituent_count, omit aggregates) - ASA r2 storage-unit provisioning
- FlexGroup expand on
update_volume - Aggregate/disk lifecycle
- A separate
create_flexgrouptool
Files
tool/tool.go— FlexGroup fields onVolumeCreate;aggregate_nameomitzeroontap/ontap.go—constituents_per_aggregate,optimize_aggregates,granular_data,granular_data_modeserver/volume.go— personality-awarenewCreateVolumerest/client.go— accessor for cached cluster flags (avoid a second/api/clusterwhen possible)server/volume_test.go— JSON-body and rejection testsdescriptions/descriptions.go,docs/tools.md,docs/examples.md
Test plan
Unit tests for: FlexVol body unchanged when new fields are unset; FlexGroup body with two aggregates and constituents_per_aggregate; reject both aggregate fields; reject FlexGroup without aggregate_names; reject flexgroup_constituent; reject FlexGroup fields on FlexVol; optimize_aggr_list omit/true; granular_data disabled/basic/advanced/invalid; classic ASA FlexGroup refuse; ASA r2 create refuse; AFX FlexGroup-field refuse. FlexVol on classic ASA remains allowed.
Activity
cgrinds commentedon Aug 31, 2026
Thanks for the issue and offer to address @dbtinsley! It probably make sense to wait until #198 is merged. Alternatively, you could also stack your PR on #198. We should get #198 in this week
dbtinsley commentedon Aug 31, 2026
@cgrinds I will wait for the 198 merge. I have a few additional issues coming that are somewhat related and it might make sense to treat them more as a single batch.
Hardikl commentedon Sep 9, 2026
@dbtinsley , PR #198 has been merged to repo. You can proceed with your PR regarding the flexgroup related changes.