mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 16:29:21 +00:00
glusterfs: retry without auto_unmount only when it's not supported
GlusterFS volume plugin should not blindly retry all failed mounts without auto_unmount, it should retry them only when we are sure that auto_unmount was the reason the first attempt failed.
This commit is contained in:
parent
5ca03d674e
commit
c20b4f7e4e
@ -344,24 +344,23 @@ func (b *glusterfsMounter) setUpAtInternal(dir string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Give a try without `auto_unmount mount option, because
|
const invalidOption = "Invalid option auto_unmount"
|
||||||
// it could be that gluster fuse client is older version and
|
if dstrings.Contains(errs.Error(), invalidOption) {
|
||||||
// mount.glusterfs is unaware of `auto_unmount`.
|
// Give a try without `auto_unmount` mount option, because
|
||||||
// Use a mount string without `auto_unmount``
|
// it could be that gluster fuse client is older version and
|
||||||
|
// mount.glusterfs is unaware of `auto_unmount`.
|
||||||
autoMountOptions := make([]string, len(mountOptions))
|
noAutoMountOptions := make([]string, len(mountOptions))
|
||||||
for _, opt := range mountOptions {
|
for _, opt := range mountOptions {
|
||||||
if opt != "auto_unmount" {
|
if opt != "auto_unmount" {
|
||||||
autoMountOptions = append(autoMountOptions, opt)
|
noAutoMountOptions = append(noAutoMountOptions, opt)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
errs = b.mounter.Mount(ip+":"+b.path, dir, "glusterfs", noAutoMountOptions)
|
||||||
|
if errs == nil {
|
||||||
|
glog.Infof("glusterfs: successfully mounted %s", dir)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
autoErr := b.mounter.Mount(ip+":"+b.path, dir, "glusterfs", autoMountOptions)
|
|
||||||
if autoErr == nil {
|
|
||||||
glog.Infof("glusterfs: successfully mounted %s", dir)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Failed mount scenario.
|
// Failed mount scenario.
|
||||||
|
Loading…
Reference in New Issue
Block a user