mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 22:46:12 +00:00
Merge pull request #46352 from humblec/gluster-mount-4
Automatic merge from submit-queue (batch tested with PRs 45913, 46065, 46352, 46363, 46373) Dont exit if 'mount.glusterfs -V' resulted in an error.
This commit is contained in:
commit
f5bdd61b12
@ -379,6 +379,7 @@ func (b *glusterfsMounter) setUpAtInternal(dir string) error {
|
|||||||
|
|
||||||
}
|
}
|
||||||
options = append(options, "backup-volfile-servers="+dstrings.Join(addrlist[:], ":"))
|
options = append(options, "backup-volfile-servers="+dstrings.Join(addrlist[:], ":"))
|
||||||
|
mountOptions := volume.JoinMountOptions(b.mountOptions, options)
|
||||||
|
|
||||||
//fetch client version.
|
//fetch client version.
|
||||||
mountBinaryVerStr := ""
|
mountBinaryVerStr := ""
|
||||||
@ -386,44 +387,43 @@ func (b *glusterfsMounter) setUpAtInternal(dir string) error {
|
|||||||
|
|
||||||
cmdOut, err := b.exe.Command(linuxGlusterMountBinary, "-V").CombinedOutput()
|
cmdOut, err := b.exe.Command(linuxGlusterMountBinary, "-V").CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Failed to get binary %s version", linuxGlusterMountBinary)
|
glog.Warningf("Failed to get binary %q version", linuxGlusterMountBinary)
|
||||||
}
|
} else {
|
||||||
//cmdOut will be filled as shown below.
|
//cmdOut will be filled as shown below.
|
||||||
/*
|
/*
|
||||||
[root@]# mount.glusterfs -V
|
[root@]# mount.glusterfs -V
|
||||||
glusterfs 3.10.1
|
glusterfs 3.10.1
|
||||||
Repository revision: git://git.gluster.org/glusterfs.git
|
Repository revision: git://git.gluster.org/glusterfs.git
|
||||||
Copyright (c) 2006-2016 Red Hat, Inc. <https://www.gluster.org/>
|
Copyright (c) 2006-2016 Red Hat, Inc. <https://www.gluster.org/>
|
||||||
GlusterFS comes with ABSOLUTELY NO WARRANTY.
|
GlusterFS comes with ABSOLUTELY NO WARRANTY.
|
||||||
.........
|
.........
|
||||||
*/
|
*/
|
||||||
|
|
||||||
parseStr := string(cmdOut)
|
parseStr := string(cmdOut)
|
||||||
if parseStr != "" {
|
if parseStr != "" {
|
||||||
|
|
||||||
//Store the version line from parseStr
|
//Store the version line from parseStr
|
||||||
mountStrSlice := dstrings.Split(parseStr, "\n")
|
mountStrSlice := dstrings.Split(parseStr, "\n")
|
||||||
if len(mountStrSlice) > 0 {
|
if len(mountStrSlice) > 0 {
|
||||||
mountStr = mountStrSlice[0]
|
mountStr = mountStrSlice[0]
|
||||||
}
|
|
||||||
if mountStr != "" {
|
|
||||||
|
|
||||||
// Get the [binary, version] slice.
|
|
||||||
mountBinaryVerSlice := dstrings.Split(mountStr, " ")
|
|
||||||
if len(mountBinaryVerSlice) >= 2 {
|
|
||||||
|
|
||||||
// Get the 'version' string in mountBinaryVerStr
|
|
||||||
mountBinaryVerStr = mountBinaryVerSlice[1]
|
|
||||||
}
|
}
|
||||||
|
if mountStr != "" {
|
||||||
|
|
||||||
|
// Get the [binary, version] slice.
|
||||||
|
mountBinaryVerSlice := dstrings.Split(mountStr, " ")
|
||||||
|
if len(mountBinaryVerSlice) >= 2 {
|
||||||
|
|
||||||
|
// Get the 'version' string in mountBinaryVerStr
|
||||||
|
mountBinaryVerStr = mountBinaryVerSlice[1]
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
mountOptions := volume.JoinMountOptions(b.mountOptions, options)
|
for i := len(mountOptions) - 1; i >= 0; i-- {
|
||||||
|
if mountOptions[i] == "auto_unmount" && mountBinaryVerStr != "" && mountBinaryVerStr < autoUnmountBinaryVer {
|
||||||
for i := len(mountOptions) - 1; i >= 0; i-- {
|
mountOptions = append(mountOptions[:i], mountOptions[i+1:]...)
|
||||||
if mountOptions[i] == "auto_unmount" && mountBinaryVerStr != "" && mountBinaryVerStr < autoUnmountBinaryVer {
|
}
|
||||||
mountOptions = append(mountOptions[:i], mountOptions[i+1:]...)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user