mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
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:
commit
92ef26d651
@ -371,18 +371,26 @@ func (b *glusterfsMounter) setUpAtInternal(dir string) error {
|
||||
}
|
||||
}
|
||||
|
||||
//Add backup-volfile-servers and auto_unmount options.
|
||||
options = append(options, "backup-volfile-servers="+dstrings.Join(addrlist[:], ":"))
|
||||
options = append(options, "auto_unmount")
|
||||
|
||||
mountOptions := volutil.JoinMountOptions(b.mountOptions, options)
|
||||
// with `backup-volfile-servers` mount 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 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))]
|
||||
|
||||
// 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)
|
||||
// with `backup-volfile-servers` mount 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 backup-volfile-servers list.
|
||||
// Refer to backup-volfile-servers @ http://docs.gluster.org/en/latest/Administrator%20Guide/Setting%20Up%20Clients/
|
||||
|
||||
errs = b.mounter.Mount(ip+":"+b.path, dir, "glusterfs", mountOptions)
|
||||
if errs == nil {
|
||||
klog.Infof("successfully mounted directory %s", dir)
|
||||
|
Loading…
Reference in New Issue
Block a user