mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 04:33:26 +00:00
add remount logic for azure file plugin
fix comments
This commit is contained in:
parent
07240b7166
commit
dce507ce69
@ -18,6 +18,7 @@ package azure_file
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
@ -241,8 +242,20 @@ func (b *azureFileMounter) SetUpAt(dir string, fsGroup *int64) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if !notMnt {
|
if !notMnt {
|
||||||
return nil
|
// testing original mount point, make sure the mount link is valid
|
||||||
|
if _, err := ioutil.ReadDir(dir); err == nil {
|
||||||
|
glog.V(4).Infof("azureFile - already mounted to target %s", dir)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
// mount link is invalid, now unmount and remount later
|
||||||
|
glog.Warningf("azureFile - ReadDir %s failed with %v, unmount this directory", dir, err)
|
||||||
|
if err := b.mounter.Unmount(dir); err != nil {
|
||||||
|
glog.Errorf("azureFile - Unmount directory %s failed with %v", dir, err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
notMnt = true
|
||||||
}
|
}
|
||||||
|
|
||||||
var accountKey, accountName string
|
var accountKey, accountName string
|
||||||
if accountName, accountKey, err = b.util.GetAzureCredentials(b.plugin.host, b.secretNamespace, b.secretName); err != nil {
|
if accountName, accountKey, err = b.util.GetAzureCredentials(b.plugin.host, b.secretNamespace, b.secretName); err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user