Merge pull request #77795 from nagexiucai/glusterfs--backup-volfile-servers--option-warning

Remove selected IP from backup-volfile-servers list to avoid warning in mount logs.
This commit is contained in:
Kubernetes Prow Robot 2019-07-01 07:23:21 -07:00 committed by GitHub
commit 92ef26d651
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -371,8 +371,18 @@ func (b *glusterfsMounter) setUpAtInternal(dir string) error {
}
}
//Add backup-volfile-servers and auto_unmount options.
if (len(addrlist) > 0) && (addrlist[0] != "") {
ip := addrlist[rand.Intn(len(addrlist))]
// Add backup-volfile-servers and auto_unmount options.
// When ip is also in backup-volfile-servers, there will be a warning:
// "gf_remember_backup_volfile_server] 0-glusterfs: failed to set volfile server: File exists".
addr.Delete(ip)
backups := addr.List()
// Avoid an invalid empty backup-volfile-servers option.
if len(backups) > 0 {
options = append(options, "backup-volfile-servers="+dstrings.Join(addrlist[:], ":"))
}
options = append(options, "auto_unmount")
mountOptions := volutil.JoinMountOptions(b.mountOptions, options)
@ -381,8 +391,6 @@ func (b *glusterfsMounter) setUpAtInternal(dir string) error {
// will fetch all the servers mentioned in the backup-volfile-servers list.
// Refer to backup-volfile-servers @ http://docs.gluster.org/en/latest/Administrator%20Guide/Setting%20Up%20Clients/
if (len(addrlist) > 0) && (addrlist[0] != "") {
ip := addrlist[rand.Intn(len(addrlist))]
errs = b.mounter.Mount(ip+":"+b.path, dir, "glusterfs", mountOptions)
if errs == nil {
klog.Infof("successfully mounted directory %s", dir)