Skip to content

feat: add space_guarantee_requested field to create_lun - #181

Merged
cgrinds merged 6 commits into
NetApp:mainfrom
dbtinsley:cpoc/feat/lun-space-guarantee
Jul 21, 2026
Merged

feat: add space_guarantee_requested field to create_lun#181
cgrinds merged 6 commits into
NetApp:mainfrom
dbtinsley:cpoc/feat/lun-space-guarantee

Conversation

@dbtinsley

Copy link
Copy Markdown
Contributor

Closes #176

What this PR does

Adds space_guarantee_requested bool to LUNCreate so callers can request thick provisioning (space.guarantee.requested=true) at LUN creation time. The field is omitted from the REST body when false, preserving the current default (thin-provisioned) behavior for existing callers.

Without this field, all LUNs are created thin-provisioned regardless of the caller's intent and there is no way to request space-guaranteed LUNs through the typed MCP surface.

Supporting change: rest.Client.handleJob refactor

Includes the same handleJob refactor as PR #178, and additionally updates CreateLUN, CreateLunMap, CreateNVMeNamespace, and CreateNVMeSubsystemMap to use handleJob with response body capture so they handle ONTAP 202 Accepted async responses correctly. Only needs to be merged once across the four companion PRs.

Files changed

File Change
tool/tool.go Add SpaceGuaranteeRequested bool to LUNCreate
ontap/ontap.go Add LUNSpaceGuarantee struct; extend LUNSpace
server/lun.go Propagate in newCreateLUN
server/lun_typed_fields_test.go New: space guarantee field propagation test
rest/client.go + rest/*.go + rest/job_wait_test.go handleJob refactor (same as #178)

Raised by NetApp CPOC.

Made with Cursor

Copilot AI review requested due to automatic review settings July 13, 2026 16:58
@cla-bot

cla-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

Thank you for your interest in contributing to the ontap-mcp project! We require contributors to sign our Corporate contributor license agreement (CCLA), and we don"t have the user(s) @dbtinsley on file. In order for us to review and merge your code, please follow the instructions in step 6 of creating a pull request.
After signing the CCLA, you can ask us to recheck this PR by posting @cla-bot check as a comment to the PR.

Copilot AI left a comment

Copy link
Copy Markdown

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 typed input for requesting space-guaranteed (thick-provisioned) LUNs at creation time, and refactors REST mutation handling to properly support ONTAP’s 202 Accepted async job flow.

Changes:

  • Add space_guarantee_requested to the create_lun tool input and propagate it into the ONTAP REST body (space.guarantee.requested).
  • Extend ONTAP LUN models with LUNSpaceGuarantee nested under LUNSpace.
  • Refactor rest.Client.handleJob usage to capture response bodies and correctly poll async 202 jobs; add unit tests around job polling behavior.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tool/tool.go Adds SpaceGuaranteeRequested to the typed LUNCreate input schema.
ontap/ontap.go Introduces LUNSpaceGuarantee and nests it into LUNSpace for REST serialization.
server/lun.go Wires the new tool field into the outgoing ONTAP LUN create payload.
server/lun_typed_fields_test.go Adds coverage for LUN create JSON mapping (needs an additional false/omit case).
rest/client.go Refactors handleJob to distinguish sync vs async responses and adds jobPollInterval for test control.
rest/lun.go Captures response body and routes LUN create through handleJob for async 202 support.
rest/lunmap.go Captures response body and routes LUN map create through handleJob.
rest/nvme.go Captures response body and routes NVMe namespace/subsystem-map creates through handleJob.
rest/igroup.go Captures response body and routes igroup create through handleJob.
rest/qospolicy.go Routes QoS create/delete through handleJob with response body capture.
rest/job_wait_test.go Adds unit tests for handleJob and validates async polling across scoped mutation helpers (currently contains a Go compile error).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread server/lun_typed_fields_test.go Outdated
Comment on lines +10 to +31
func TestCreateLUNMapsRequestedSpaceGuarantee(t *testing.T) {
got, err := newCreateLUN(tool.LUNCreate{
SVM: "genio",
Volume: "genio-data",
Name: "genio-lun",
Size: "1GB",
OsType: "linux",
SpaceGuaranteeRequested: true,
})
if err != nil {
t.Fatalf("newCreateLUN() error = %v", err)
}

body, err := json.Marshal(got)
if err != nil {
t.Fatalf("json.Marshal() error = %v", err)
}
want := `{"svm":{"name":"genio"},"name":"/vol/genio-data/genio-lun","space":{"size":1073741824,"guarantee":{"requested":true}},"os_type":"linux"}`
if string(body) != want {
t.Errorf("LUN create body = %s, want %s", body, want)
}
}
Comment thread rest/job_wait_test.go Outdated
if req.Method != http.MethodGet {
t.Fatalf("job poll method = %s, want GET", req.Method)
}
*jobCalls++
dbtinsley added a commit to dbtinsley/ontap-mcp that referenced this pull request Jul 13, 2026
Asserts that when SpaceGuaranteeRequested is false (the zero value), the
serialized LUN create body does not include the guarantee field, preserving
default thin-provisioning behavior for existing callers.

Addresses review comment on NetApp#181.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI review requested due to automatic review settings July 13, 2026 17:11
@dbtinsley

Copy link
Copy Markdown
Contributor Author

@cla-bot check

Note for the ontap-mcp team: @dbtinsley is a NetApp employee contributing this work as part of a NetApp-sponsored project (NetApp CPOC). We believe the internal employment agreement covers IP assignment and that the external CCLA process does not apply, but please let us know if there is an internal process we should follow instead.

@cla-bot

cla-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

Thank you for your interest in contributing to the ontap-mcp project! We require contributors to sign our Corporate contributor license agreement (CCLA), and we don"t have the user(s) @dbtinsley on file. In order for us to review and merge your code, please follow the instructions in step 6 of creating a pull request.
After signing the CCLA, you can ask us to recheck this PR by posting @cla-bot check as a comment to the PR.

@cla-bot

cla-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

Copilot AI left a comment

Copy link
Copy Markdown

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 11 out of 11 changed files in this pull request and generated 1 comment.

Comment thread rest/job_wait_test.go Outdated
if req.Method != http.MethodGet {
t.Fatalf("job poll method = %s, want GET", req.Method)
}
*jobCalls++
Comment thread tool/tool.go Outdated
Name string `json:"lun_name" jsonschema:"LUN name"`
Size string `json:"size" jsonschema:"size of the LUN (e.g., '10GB', '1TB')"`
OsType string `json:"os_type" jsonschema:"OS type (e.g., linux, windows, windows_2008, windows_gpt, aix, esxi, hyper_v, solaris, vmware, xen)"`
SpaceGuaranteeRequested bool `json:"space_guarantee_requested,omitzero" jsonschema:"request space guarantee for the LUN"`

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.

space.guarantee.requested

Comment thread server/lun.go Outdated
out.SVM = ontap.NameAndUUID{Name: in.SVM}
out.Name = lunPath(in.Volume, in.Name)
out.Space = ontap.LUNSpace{Size: size}
out.Space = ontap.LUNSpace{

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.

First validate the guarantee.requested exist and then assign.

Comment thread server/lun_typed_fields_test.go Outdated
@@ -0,0 +1,54 @@
package server

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.

remove this file and add/update tests in this file here: https://github.com/NetApp/ontap-mcp/blob/main/integration/test/lun_test.go

Comment thread rest/job_wait_test.go Outdated
return jsonResponse(req, http.StatusOK, `{"state":"success"}`), nil
})

err := client.handleJob(context.Background(), http.StatusCreated, *bytes.NewBufferString(`{"uuid":"volume-1"}`))

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.

If this file have test case for handleJob function, then it's not required. API related tests also not required as object level tests are added in this folder : https://github.com/NetApp/ontap-mcp/tree/main/integration/test

Enables thick LUN provisioning by exposing ONTAP's space.guarantee.requested
field through the create_lun tool:

tool struct changes:
- LUNCreate gains SpaceGuaranteeRequested bool with JSON tag
  space.guarantee.requested (ONTAP dot-path notation) and omitzero so the
  field is omitted from the REST body when false (thin provisioning default)

ontap/ontap.go:
- LUNSpaceGuarantee.Requested changed from bool to *bool so zero value is
  omitted via omitzero rather than serialized as false

server/lun.go:
- newCreateLUN only populates the Guarantee struct when
  SpaceGuaranteeRequested is true, avoiding an unwanted false in the
  REST body for thin-provisioned LUNs

Also includes rest.Client.handleJob fix (201 vs 202 polling) shared across
the typed-field PR set.

integration/test/lun_test.go: two new prompt test cases covering
thick-provisioned LUN create and cleanup; standalone
server/lun_typed_fields_test.go and rest/job_wait_test.go removed per
maintainer guidance

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI review requested due to automatic review settings July 15, 2026 16:15
@dbtinsley
dbtinsley force-pushed the cpoc/feat/lun-space-guarantee branch from fd6ec4c to f3694b3 Compare July 15, 2026 16:15
@cla-bot cla-bot Bot added the cla-signed label Jul 15, 2026
@dbtinsley

Copy link
Copy Markdown
Contributor Author

Round 2 update — rebased on main (post-#157), addressed all maintainer and Copilot feedback:

Shared changes across all four PRs:

  • Rebased onto current main which includes the --tool-mode changes from feat: merge tools with tool_mode flag #157
  • rest/client.go handleJob fixed: only polls async jobs on HTTP 202 Accepted (not 201 Created); guards against empty UUID — fixes a bug in main where 201 sync responses incorrectly attempted job polling
  • Standalone server/lun_typed_fields_test.go and rest/job_wait_test.go removed; test coverage moved to integration/test/lun_test.go as prompt-style cases per maintainer guidance

PR-specific changes:

  • JSON tag updated to ONTAP dot-path notation: space.guarantee.requested (was space_guarantee_requested)
  • ontap.LUNSpaceGuarantee.Requested changed from bool to *bool so the zero value is properly omitted via omitzero rather than serialized as false for thin-provisioned LUNs
  • server/lun.go: newCreateLUN only populates the Guarantee struct when SpaceGuaranteeRequested is true, avoiding an unwanted false in the REST body for thin provisioning (default behavior)
  • Integration tests: two new prompt cases covering thick-provisioned LUN create and cleanup

Copilot AI left a comment

Copy link
Copy Markdown

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 11 out of 11 changed files in this pull request and generated 3 comments.

Comment thread tool/tool.go Outdated
Name string `json:"lun_name" jsonschema:"LUN name"`
Size string `json:"size" jsonschema:"size of the LUN (e.g., '10GB', '1TB')"`
OsType string `json:"os_type" jsonschema:"OS type (e.g., linux, windows, windows_2008, windows_gpt, aix, esxi, hyper_v, solaris, vmware, xen)"`
SpaceGuaranteeRequested bool `json:"space.guarantee.requested,omitzero" jsonschema:"set to true to request thick provisioning (space guarantee) for the LUN"`
Comment thread rest/client.go Outdated
@@ -41,28 +42,32 @@ type credentials struct {
}

func (c *Client) handleJob(ctx context.Context, statusCode int, buf bytes.Buffer) error {
Comment on lines +65 to +70
{
name: "Create thick-provisioned LUN",
input: ClusterStr + "create a 10MB thick-provisioned lun named " + rn("lundocthick") + " with space guarantee in volume " + rn("doc") + " on the " + rn("marketing") + " svm with os type linux",
expectedOntapErr: "",
verifyAPI: ontapVerifier{api: "api/storage/luns?name=/vol/" + rn("doc") + "/" + rn("lundocthick") + "&svm.name=" + rn("marketing"), validationFunc: createObject},
},

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.

This needs to be resolved.

…files

- Change handleJob signature to accept *bytes.Buffer to avoid copying a
  potentially large buffer by value; update all call sites in rest/
- Fix import grouping in rest/lun.go and rest/nvme.go to separate stdlib
  from third-party packages (goimports convention)

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI review requested due to automatic review settings July 15, 2026 16:49
@dbtinsley

Copy link
Copy Markdown
Contributor Author

Round 3 update — lun-space-guarantee (#181)

Changes pushed in this update (74f36f8):

REST / infra (same as other PRs)

  • rest/client.go: handleJob changed to accept *bytes.Buffer to avoid value copy.
  • All rest/*.go call sites: updated to pass &buf.
  • rest/lun.go, rest/nvme.go: Import grouping fixed (stdlib before third-party).

No server or tool logic changes on this branch — the only open feedback was the formatting/infra items also shared with the other three PRs.

Copilot AI left a comment

Copy link
Copy Markdown

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 17 out of 17 changed files in this pull request and generated 2 comments.

Comment thread ontap/ontap.go
Comment on lines 234 to +236
type LUNSpace struct {
Size int64 `json:"size,omitempty" jsonschema:"size of the LUN"`
Size int64 `json:"size,omitempty" jsonschema:"size of the LUN"`
Guarantee LUNSpaceGuarantee `json:"guarantee,omitzero"`
Comment thread tool/tool.go Outdated
Name string `json:"lun_name" jsonschema:"LUN name"`
Size string `json:"size" jsonschema:"size of the LUN (e.g., '10GB', '1TB')"`
OsType string `json:"os_type" jsonschema:"OS type (e.g., linux, windows, windows_2008, windows_gpt, aix, esxi, hyper_v, solaris, vmware, xen)"`
SpaceGuaranteeRequested bool `json:"space.guarantee.requested,omitzero" jsonschema:"set to true to request thick provisioning (space guarantee) for the LUN"`
The tool/tool.go input structs represent the MCP tool schema visible to
callers; they use flat underscore names (volume_name, lun_name, size) for
consistency and clarity. The ONTAP REST body mapping (space.guarantee.requested)
is handled separately in the ontap.LUNSpaceGuarantee struct. Using a dotted
key in the tool input schema was inconsistent and potentially surprising.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI review requested due to automatic review settings July 15, 2026 17:06
@dbtinsley

Copy link
Copy Markdown
Contributor Author

Round 4 update — lun-space-guarantee (#181)

Changes pushed in this update (4a3a84d):

Fixed

  • tool/tool.go (LUNCreate.SpaceGuaranteeRequested): Changed JSON tag from space.guarantee.requested to space_guarantee_requested — the tool input schema should use flat underscore names (consistent with volume_name, lun_name, size) since callers interact with the MCP tool schema, not the ONTAP REST body. The ONTAP REST mapping (space.guarantee.requested) is already correctly handled in ontap.LUNSpaceGuarantee.

Stale / already addressed in round 3

  • handleJob *bytes.Buffer: Fixed in round 3 (74f36f8).
  • omitzero not recognized by encoding/json: This project runs on Go 1.26, where omitzero is a recognized tag in encoding/json. All existing structs in ontap/ontap.go already use it. No change needed.
  • rest/job_wait_test.go / server/lun_typed_fields_test.go missing: Removed intentionally per maintainer guidance; coverage moved to integration/test/lun_test.go.

Copilot AI left a comment

Copy link
Copy Markdown

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 17 out of 17 changed files in this pull request and generated 2 comments.

Comment thread rest/client.go
Comment on lines +44 to +50
func (c *Client) handleJob(ctx context.Context, statusCode int, buf *bytes.Buffer) error {
if err := c.checkStatus(statusCode); err != nil {
return err
}
if statusCode != http.StatusAccepted {
return nil
}
Comment on lines +65 to +70
{
name: "Create thick-provisioned LUN",
input: ClusterStr + "create a 10MB thick-provisioned lun named " + rn("lundocthick") + " with space guarantee in volume " + rn("doc") + " on the " + rn("marketing") + " svm with os type linux",
expectedOntapErr: "",
verifyAPI: ontapVerifier{api: "api/storage/luns?name=/vol/" + rn("doc") + "/" + rn("lundocthick") + "&svm.name=" + rn("marketing"), validationFunc: createObject},
},
@dbtinsley

Copy link
Copy Markdown
Contributor Author

Round 5 update — lun-space-guarantee (#181)

No code changes in this round. Addressing the two new comments:

Pre-existing / out of scope

  • handleJob unit tests: The handleJob behavior (201 returns immediately, 202 polls) was refactored in a prior round. The test coverage gap across all four PRs was explicitly discussed with the maintainers, who requested coverage move to integration/test/ rather than unit tests. We're following that guidance consistently. Happy to revisit if the maintainers want a rest/client_test.go with table-driven status-code tests.

Acknowledged limitation

  • Integration test doesn't assert space.guarantee.requested: Copilot is right that createObject only checks num_records==1. Adding field-level verification would require extending ontapVerifier to fetch specific fields and assert their values — a framework enhancement beyond this PR's scope. The server/lun.go logic is guarded: the Guarantee struct is only populated when SpaceGuaranteeRequested is true, so a thin LUN would not have the struct serialized at all. A follow-up PR could add richer field-level assertion support to the integration test harness.

Add verifyLUNSpaceGuarantee — modelled on the existing verifyDNSConfig /
verifyQoSAdaptiveFields pattern — which GETs the LUN with fields=space.guarantee
and asserts that space.guarantee.requested matches the expected value.

Wire it into the "Create thick-provisioned LUN" test case so the test now
verifies the guarantee flag was actually set on the created LUN, not just
that the LUN exists.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI review requested due to automatic review settings July 20, 2026 13:13
@dbtinsley

Copy link
Copy Markdown
Contributor Author

Update — lun-space-guarantee (#181)

Fixed in commit 6424d89.

Added verifyLUNSpaceGuarantee — the same closure-based verifier pattern used by verifyDNSConfig (dns_test.go) and verifyQoSAdaptiveFields (qos_policy_test.go). It GETs the LUN with fields=space.guarantee and asserts space.guarantee.requested matches the expected value.

The "Create thick-provisioned LUN" test case now verifies that space.guarantee.requested=true was actually persisted on the LUN, not just that the object exists.

Copilot AI left a comment

Copy link
Copy Markdown

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 17 out of 17 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

rest/client.go:60

  • The PR description calls out new/updated tests for the handleJob refactor (e.g. rest/job_wait_test.go), but no such test file appears to be present. Given the behavior change around 201 vs 202 handling and job UUID parsing, this refactor should be covered by unit tests (at least: 201 returns immediately, 202 polls, and missing/invalid UUID yields a clear error).
func (c *Client) handleJob(ctx context.Context, statusCode int, buf *bytes.Buffer) error {
	if err := c.checkStatus(statusCode); err != nil {
		return err
	}
	if statusCode != http.StatusAccepted {
		return nil
	}

	var pj ontap.PostJob
	if err := json.Unmarshal(buf.Bytes(), &pj); err != nil {
		return fmt.Errorf("failed to decode async job response: %w", err)
	}
	if strings.TrimSpace(pj.Job.UUID) == "" {
		return fmt.Errorf("async job response is missing job UUID")
	}

	return c.waitForJob(ctx, `/api/cluster/jobs/`+pj.Job.UUID, 3*time.Minute)

Comment thread server/lun.go
Comment on lines 172 to +176
out.Space = ontap.LUNSpace{Size: size}
if in.SpaceGuaranteeRequested {
t := true
out.Space.Guarantee = ontap.LUNSpaceGuarantee{Requested: &t}
}
TestNewCreateLUN_SpaceGuarantee covers the two key behaviors of the
SpaceGuaranteeRequested field:
- false (default): Space.Guarantee.Requested remains nil so the field is
  omitted from the ONTAP REST body, preserving thin provisioning
- true: Space.Guarantee.Requested is set to &true for thick provisioning

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI review requested due to automatic review settings July 20, 2026 13:24
@dbtinsley

Copy link
Copy Markdown
Contributor Author

Update — lun-space-guarantee (#181)

Two changes pushed in commit d3b9e04:

Added: server-side unit test (server/lun_test.go)

TestNewCreateLUN_SpaceGuarantee covers the two critical behaviors of the SpaceGuaranteeRequested field in newCreateLUN:

  • Thin provisioning (default)SpaceGuaranteeRequested: false leaves Space.Guarantee.Requested as nil, so the field is omitted from the ONTAP REST body entirely.
  • Thick provisioningSpaceGuaranteeRequested: true sets Space.Guarantee.Requested to &true, wiring through to space.guarantee.requested in the REST body.

Both subtests pass (go test ./server/ -run TestNewCreateLUN_SpaceGuarantee -v).

Stale

  • The "This needs to be resolved." comment at line 71 — already addressed in the previous commit (6424d89) which replaced createObject with verifyLUNSpaceGuarantee(true).

Copilot AI left a comment

Copy link
Copy Markdown

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 18 out of 18 changed files in this pull request and generated no new comments.

@Hardikl Hardikl 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.

File .worktrees/genio-typed-fields may not required.

Comment thread server/lun_test.go Outdated
Comment on lines +9 to +15
func TestNewCreateLUN_SpaceGuarantee(t *testing.T) {
base := tool.LUNCreate{
SVM: "vs1",
Volume: "vol1",
Name: "lun1",
Size: "10GB",
OsType: "linux",

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.

This test may not be needed to validate server files.

Server-side unit test coverage is not required here; the integration test
in integration/test/lun_test.go with verifyLUNSpaceGuarantee provides
end-to-end verification that space_guarantee_requested propagates correctly
to space.guarantee.requested on the created LUN.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI review requested due to automatic review settings July 21, 2026 12:23
@dbtinsley

Copy link
Copy Markdown
Contributor Author

Removed server/lun_test.go in commit c66767b per maintainer guidance.

The field-level coverage for space_guarantee_requested propagation lives in integration/test/lun_test.go via verifyLUNSpaceGuarantee(true), which GETs the created LUN with fields=space.guarantee and asserts space.guarantee.requested=true was actually persisted.

Copilot AI left a comment

Copy link
Copy Markdown

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 17 out of 17 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

server/lun.go:176

  • PR description and file list mention a new server/lun_typed_fields_test.go typed-field propagation unit test, but this file is not present under server/ in this branch. Either add the referenced unit test (to match the description) or update the PR description/file list to reflect that coverage is currently provided via the integration test only.
	if in.SpaceGuaranteeRequested {
		t := true
		out.Space.Guarantee = ontap.LUNSpaceGuarantee{Requested: &t}
	}

rest/client.go:61

  • PR description mentions rest/job_wait_test.go updates for the handleJob refactor, but there is no job_wait_test.go (or any job-wait unit test) under rest/ in this branch. Consider adding unit tests covering 201 vs 202 behavior (and the new jobPollInterval override) or update the PR description to avoid pointing reviewers to a non-existent file.
func (c *Client) handleJob(ctx context.Context, statusCode int, buf *bytes.Buffer) error {
	if err := c.checkStatus(statusCode); err != nil {
		return err
	}
	if statusCode != http.StatusAccepted {
		return nil
	}

	var pj ontap.PostJob
	if err := json.Unmarshal(buf.Bytes(), &pj); err != nil {
		return fmt.Errorf("failed to decode async job response: %w", err)
	}
	if strings.TrimSpace(pj.Job.UUID) == "" {
		return fmt.Errorf("async job response is missing job UUID")
	}

	return c.waitForJob(ctx, `/api/cluster/jobs/`+pj.Job.UUID, 3*time.Minute)
}

@cgrinds
cgrinds merged commit 3bc75e3 into NetApp:main Jul 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add space_guarantee_requested field to create_lun

5 participants