mirror of https://github.com/minio/minio.git
				
				
				
			Do not append the endpoint for fs/xl disks in StorageInfo (#8472)
This commit is contained in:
		
							parent
							
								
									eac518b178
								
							
						
					
					
						commit
						fa325665b1
					
				|  | @ -252,12 +252,11 @@ func (fs *FSObjects) StorageInfo(ctx context.Context) StorageInfo { | |||
| 	if !fs.diskMount { | ||||
| 		used = atomic.LoadUint64(&fs.totalUsed) | ||||
| 	} | ||||
| 	localPeer := GetLocalPeer(globalEndpoints) | ||||
| 	storageInfo := StorageInfo{ | ||||
| 		Used:       []uint64{used}, | ||||
| 		Total:      []uint64{di.Total}, | ||||
| 		Available:  []uint64{di.Free}, | ||||
| 		MountPaths: []string{localPeer + fs.fsPath}, | ||||
| 		MountPaths: []string{fs.fsPath}, | ||||
| 	} | ||||
| 	storageInfo.Backend.Type = BackendFS | ||||
| 	return storageInfo | ||||
|  |  | |||
							
								
								
									
										12
									
								
								cmd/posix.go
								
								
								
								
							
							
						
						
									
										12
									
								
								cmd/posix.go
								
								
								
								
							|  | @ -321,11 +321,15 @@ type DiskInfo struct { | |||
| // total free inodes and underlying filesystem.
 | ||||
| func (s *posix) DiskInfo() (info DiskInfo, err error) { | ||||
| 	defer func() { | ||||
| 		if err == errFaultyDisk { | ||||
| 		if s != nil && err == errFaultyDisk { | ||||
| 			atomic.AddInt32(&s.ioErrCount, 1) | ||||
| 		} | ||||
| 	}() | ||||
| 
 | ||||
| 	if s == nil { | ||||
| 		return info, errFaultyDisk | ||||
| 	} | ||||
| 
 | ||||
| 	if atomic.LoadInt32(&s.ioErrCount) > maxAllowedIOError { | ||||
| 		return info, errFaultyDisk | ||||
| 	} | ||||
|  | @ -344,7 +348,11 @@ func (s *posix) DiskInfo() (info DiskInfo, err error) { | |||
| 	if err != nil { | ||||
| 		return info, err | ||||
| 	} | ||||
| 	localPeer := GetLocalPeer(globalEndpoints) | ||||
| 
 | ||||
| 	localPeer := "" | ||||
| 	if globalIsDistXL { | ||||
| 		localPeer = GetLocalPeer(globalEndpoints) | ||||
| 	} | ||||
| 
 | ||||
| 	return DiskInfo{ | ||||
| 		Total:        di.Total, | ||||
|  |  | |||
|  | @ -99,6 +99,10 @@ func getDisksInfo(disks []StorageAPI) (disksInfo []DiskInfo, onlineDisks, offlin | |||
| 
 | ||||
| 	getPeerAddress := func(diskPath string) (string, error) { | ||||
| 		hostPort := strings.Split(diskPath, SlashSeparator)[0] | ||||
| 		// Host will be empty for xl/fs disk paths.
 | ||||
| 		if hostPort == "" { | ||||
| 			return "", nil | ||||
| 		} | ||||
| 		thisAddr, err := xnet.ParseHost(hostPort) | ||||
| 		if err != nil { | ||||
| 			return "", err | ||||
|  | @ -111,6 +115,7 @@ func getDisksInfo(disks []StorageAPI) (disksInfo []DiskInfo, onlineDisks, offlin | |||
| 	// Wait for the routines.
 | ||||
| 	for i, err := range g.Wait() { | ||||
| 		peerAddr, pErr := getPeerAddress(disksInfo[i].RelativePath) | ||||
| 
 | ||||
| 		if pErr != nil { | ||||
| 			continue | ||||
| 		} | ||||
|  | @ -122,6 +127,7 @@ func getDisksInfo(disks []StorageAPI) (disksInfo []DiskInfo, onlineDisks, offlin | |||
| 		} | ||||
| 		if err != nil { | ||||
| 			offlineDisks[peerAddr]++ | ||||
| 			continue | ||||
| 		} | ||||
| 		onlineDisks[peerAddr]++ | ||||
| 	} | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue