Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dont exit if 'mount.glusterfs -V' resulted in an error. #46352

Merged
merged 1 commit into from
May 25, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
66 changes: 33 additions & 33 deletions pkg/volume/glusterfs/glusterfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,51 +379,51 @@ func (b *glusterfsMounter) setUpAtInternal(dir string) error {

}
options = append(options, "backup-volfile-servers="+dstrings.Join(addrlist[:], ":"))
mountOptions := volume.JoinMountOptions(b.mountOptions, options)

//fetch client version.
mountBinaryVerStr := ""
mountStr := ""

cmdOut, err := b.exe.Command(linuxGlusterMountBinary, "-V").CombinedOutput()
if err != nil {
return fmt.Errorf("Failed to get binary %s version", linuxGlusterMountBinary)
}
//cmdOut will be filled as shown below.
/*
[root@]# mount.glusterfs -V
glusterfs 3.10.1
Repository revision: git://git.gluster.org/glusterfs.git
Copyright (c) 2006-2016 Red Hat, Inc. <https://www.gluster.org/>
GlusterFS comes with ABSOLUTELY NO WARRANTY.
.........
*/

parseStr := string(cmdOut)
if parseStr != "" {

//Store the version line from parseStr
mountStrSlice := dstrings.Split(parseStr, "\n")
if len(mountStrSlice) > 0 {
mountStr = mountStrSlice[0]
}
if mountStr != "" {
glog.Warningf("Failed to get binary %q version", linuxGlusterMountBinary)
} else {
//cmdOut will be filled as shown below.
/*
[root@]# mount.glusterfs -V
glusterfs 3.10.1
Repository revision: git://git.gluster.org/glusterfs.git
Copyright (c) 2006-2016 Red Hat, Inc. <https://www.gluster.org/>
GlusterFS comes with ABSOLUTELY NO WARRANTY.
.........
*/

parseStr := string(cmdOut)
if parseStr != "" {

//Store the version line from parseStr
mountStrSlice := dstrings.Split(parseStr, "\n")
if len(mountStrSlice) > 0 {
mountStr = mountStrSlice[0]
}
if mountStr != "" {

// Get the [binary, version] slice.
mountBinaryVerSlice := dstrings.Split(mountStr, " ")
if len(mountBinaryVerSlice) >= 2 {
// Get the [binary, version] slice.
mountBinaryVerSlice := dstrings.Split(mountStr, " ")
if len(mountBinaryVerSlice) >= 2 {

// Get the 'version' string in mountBinaryVerStr
mountBinaryVerStr = mountBinaryVerSlice[1]
}
// 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 {
mountOptions = append(mountOptions[:i], mountOptions[i+1:]...)
for i := len(mountOptions) - 1; i >= 0; i-- {
if mountOptions[i] == "auto_unmount" && mountBinaryVerStr != "" && mountBinaryVerStr < autoUnmountBinaryVer {
mountOptions = append(mountOptions[:i], mountOptions[i+1:]...)
}
}
}

Expand Down