Commit 01085826 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #49127 from humblec/backupvol-count

Automatic merge from submit-queue (batch tested with PRs 49328, 49285, 49307, 49127, 49163) Make definite mount timeout for glusterfs volume mount. The `backup-volfile-servers` mount option allows to specify more than one server to be contacted in single mount command. With this option in place, it is not required to iterate over all the servers in the addrlist. A mount attempt with this option will fetch all the servers mentioned in the list, Reference # https://access.redhat.com/documentation/en-US/Red_Hat_Storage/3/html/Administration_Guide/sect-Native_Client.htmlSigned-off-by: 's avatarHumble Chirammal <hchiramm@redhat.com>
parents 7a055732 413380e5
...@@ -335,9 +335,13 @@ func (b *glusterfsMounter) setUpAtInternal(dir string) error { ...@@ -335,9 +335,13 @@ 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) mountOptions := volume.JoinMountOptions(b.mountOptions, options)
// Avoid mount storm, pick a host randomly. // with `backup-volfile-servers` mount option in place, it is not required to
// Iterate all hosts until mount succeeds. // iterate over all the servers in the addrlist. A mount attempt with this option
for _, ip := range addrlist { // will fetch all the servers mentioned in the backup-volfile-servers list.
// Refer backup-volfile-servers @ https://access.redhat.com/documentation/en-US/Red_Hat_Storage/3/html/Administration_Guide/sect-Native_Client.html
if (len(addrlist) > 0) && (addrlist[0] != "") {
ip := addrlist[0]
errs = b.mounter.Mount(ip+":"+b.path, dir, "glusterfs", mountOptions) errs = b.mounter.Mount(ip+":"+b.path, dir, "glusterfs", mountOptions)
if errs == nil { if errs == nil {
glog.Infof("glusterfs: successfully mounted %s", dir) glog.Infof("glusterfs: successfully mounted %s", dir)
...@@ -361,6 +365,8 @@ func (b *glusterfsMounter) setUpAtInternal(dir string) error { ...@@ -361,6 +365,8 @@ func (b *glusterfsMounter) setUpAtInternal(dir string) error {
return nil return nil
} }
} }
} else {
return fmt.Errorf("glusterfs: failed to execute mount command:[no valid ipaddress found in endpoint address list]")
} }
// Failed mount scenario. // Failed mount scenario.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment