Skip to content

Implement Rename() for ontap-nas-economy and ontap-san-economy drivers - #1191

Open
anshulj07 wants to merge 1 commit into
NetApp:masterfrom
anshulj07:issue-1160-economy-driver-rename
Open

anshulj07 wants to merge 1 commit into
NetApp:masterfrom
anshulj07:issue-1160-economy-driver-rename

Conversation

@anshulj07

Copy link
Copy Markdown

Summary

Fixes #1160. Implements Rename() for the ontap-nas-economy (qtree) and ontap-san-economy (LUN) drivers, which previously returned a hard "rename is not implemented" error.

As flagged in the issue discussion, Rename() for these drivers is used to clean up after a failed volume import, and ImportOriginalName (the newName passed in that path) can be a compound "flexvol/qtree" (or "flexvol/LUN") path rather than a plain name, since Import() may have renamed both the qtree/LUN and its bucket FlexVol.

To handle this safely:

  • Rename() locates the qtree/LUN's current FlexVol and renames it in place.
  • If newName is a compound "flexvol/qtree"/"flexvol/LUN" path, it's treated as an import-cleanup revert: after renaming the object back, the FlexVol name is also reverted, but only if that FlexVol still holds exactly one qtree/LUN (bucket FlexVols are shared, so renaming one out from under other qtrees/LUNs would orphan them since their InternalID pins them to the current FlexVol name).
  • If the FlexVol rename fails after the qtree/LUN rename succeeded, the qtree/LUN rename is rolled back to avoid leaving a half-reverted state.

Test plan

  • go build ./storage_drivers/ontap/... passes
  • go vet ./storage_drivers/ontap/... passes (pre-existing, unrelated warning only)
  • New unit tests added for both drivers covering: plain rename, not-found, API failures, safe FlexVol revert, shared-FlexVol skip, target-name-collision skip, and rollback-on-FlexVol-rename-failure
  • Full storage_drivers/ontap/... test suite passes with no regressions

Rename() locates the qtree/LUN's current FlexVol and renames it in place.
When newName is a "flexvol/qtree" (or "flexvol/LUN") path -- the format
ImportOriginalName uses -- it is treated as an import-failure cleanup
revert: after renaming the object back, the FlexVol name is also reverted,
but only if that FlexVol still holds exactly one qtree/LUN, since bucket
FlexVols are shared and renaming one out from under other qtrees/LUNs
would orphan them. If the FlexVol rename fails, the qtree/LUN rename is
rolled back to avoid a half-reverted state.

Fixes NetApp#1160
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.

Implement Rename() for ontap-nas-economy (qtree) and ontap-san-economy drivers

1 participant