mirror of https://github.com/k3s-io/k3s
Merge pull request #59540 from andyzhangx/azurefile-windows-fix
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. return error if New-SmbGlobalMapping failed when mounting azure file on Windows **What this PR does / why we need it**: This PR will return error if New-SmbGlobalMapping failed when mounting azure file on Windows. User wants to create a pod moutning with azure file pvc using static provisioning([doc](https://github.com/andyzhangx/Demo/tree/master/windows/azurefile#static-provisioning-for-azure-file-on-windows-server-version-1709support-from-v17x])) and user uses a wrong storage account name or key, current behavior is if mount azure file on Windows, it will create an empty directory, and user would not know actually it fails. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes #59538 **Special notes for your reviewer**: **Release note**: ``` return error if New-SmbGlobalMapping failed when mounting azure file on Windows ```pull/6/head
commit
28b4bb0fd6
|
@ -89,10 +89,7 @@ func (mounter *Mounter) Mount(source string, target string, fstype string, optio
|
||||||
cmdLine += fmt.Sprintf(";New-SmbGlobalMapping -RemotePath %s -Credential $Credential", source)
|
cmdLine += fmt.Sprintf(";New-SmbGlobalMapping -RemotePath %s -Credential $Credential", source)
|
||||||
|
|
||||||
if output, err := exec.Command("powershell", "/c", cmdLine).CombinedOutput(); err != nil {
|
if output, err := exec.Command("powershell", "/c", cmdLine).CombinedOutput(); err != nil {
|
||||||
// we don't return error here, even though New-SmbGlobalMapping failed, we still make it successful,
|
return fmt.Errorf("azureMount: SmbGlobalMapping failed: %v, only SMB mount is supported now, output: %q", err, string(output))
|
||||||
// will return error when Windows 2016 RS3 is ready on azure
|
|
||||||
glog.Errorf("azureMount: SmbGlobalMapping failed: %v, only SMB mount is supported now, output: %q", err, string(output))
|
|
||||||
return os.MkdirAll(target, 0755)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue