mirror of
https://github.com/pgsty/minio.git
synced 2026-10-07 02:05:58 +03:00
fix storage info output with unordered endpoints arguments (#9610)
Shuffling arguments that we pass to MinIO server are supported. However, when that happens, Prometheus returns wrong information about disks usage and online/offline status. The commit fixes the issue by avoiding relying on xl.endpoints since it is not ordered.
This commit is contained in:
+11
-4
@@ -87,7 +87,9 @@ type posix struct {
|
||||
activeIOCount int32
|
||||
|
||||
diskPath string
|
||||
pool sync.Pool
|
||||
hostname string
|
||||
|
||||
pool sync.Pool
|
||||
|
||||
diskMount bool // indicates if the path is an actual mount.
|
||||
|
||||
@@ -228,7 +230,7 @@ func isDirEmpty(dirname string) bool {
|
||||
}
|
||||
|
||||
// Initialize a new storage disk.
|
||||
func newPosix(path string) (*posix, error) {
|
||||
func newPosix(path string, hostname string) (*posix, error) {
|
||||
var err error
|
||||
if path, err = getValidPath(path, true); err != nil {
|
||||
return nil, err
|
||||
@@ -239,6 +241,7 @@ func newPosix(path string) (*posix, error) {
|
||||
}
|
||||
p := &posix{
|
||||
diskPath: path,
|
||||
hostname: hostname,
|
||||
pool: sync.Pool{
|
||||
New: func() interface{} {
|
||||
b := disk.AlignedBlock(readBlockSize)
|
||||
@@ -339,8 +342,8 @@ func (s *posix) String() string {
|
||||
return s.diskPath
|
||||
}
|
||||
|
||||
func (*posix) Hostname() string {
|
||||
return ""
|
||||
func (s *posix) Hostname() string {
|
||||
return s.hostname
|
||||
}
|
||||
|
||||
func (s *posix) Close() error {
|
||||
@@ -352,6 +355,10 @@ func (s *posix) IsOnline() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *posix) IsLocal() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *posix) waitForLowActiveIO() {
|
||||
for atomic.LoadInt32(&s.activeIOCount) >= s.maxActiveIOCount {
|
||||
time.Sleep(lowActiveIOWaitTick)
|
||||
|
||||
Reference in New Issue
Block a user