fix: support createFolderIfNotExist for NFS protocol#3052
Closed
andyzhangx wants to merge 1 commit intomasterfrom
Closed
fix: support createFolderIfNotExist for NFS protocol#3052andyzhangx wants to merge 1 commit intomasterfrom
andyzhangx wants to merge 1 commit intomasterfrom
Conversation
When using NFS protocol, GetAccountInfo returns early without an account key since NFS doesn't need one. However, createFolderIfNotExists requires an account key to create a data plane client, so it silently fails for NFS shares. Fix: For NFS, mount the share root to a temporary directory, create the folder using os.MkdirAll, then unmount. This avoids the need for an account key entirely. Fixes: #3041
Contributor
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: andyzhangx The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
createFolderIfNotExistdoes not work when using NFS protocol (#3041).Root cause: In NFS mode,
GetAccountInforeturns early without retrieving the storage account key (NFS doesn't need one for mounting). However,createFolderIfNotExistscallsnewAzureFileClientwhich requires the account key to create a data plane client. With an empty key, the client creation fails and folder creation silently doesn't happen.Fix
For NFS protocol, use a different approach to create folders:
os.MkdirAllThis avoids the need for an account key entirely, leveraging the fact that NFS mounts don't require storage account authentication.
Changes
nodeserver.go: Branch on protocol in thecreateFolderIfNotExistlogic — use data plane client for SMB, use temp mount + MkdirAll for NFSnodeserver.go: AddcreateFolderOnNfsSharemethodFixes #3041