Skip to content

Commit c117601

Browse files
vadmesteAnis Elleuch
andauthored
Update madmin-go to 2.1.1 (#2810)
Update madmin-go library + github.com/minio/mc Also update the code to work with the library update Co-authored-by: Anis Elleuch <anis@min.io>
1 parent f78f838 commit c117601

File tree

4 files changed

+13
-40
lines changed

4 files changed

+13
-40
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ require (
2222
github.com/minio/directpv v1.4.4-0.20220805090942-948ca4731651
2323
github.com/minio/highwayhash v1.0.2
2424
github.com/minio/kes v0.22.3
25-
github.com/minio/madmin-go/v2 v2.0.20
26-
github.com/minio/mc v0.0.0-20230421183052-0da22db3af01
25+
github.com/minio/madmin-go/v2 v2.1.1
26+
github.com/minio/mc v0.0.0-20230509151326-6050568e66a6
2727
github.com/minio/minio-go/v7 v7.0.52
2828
github.com/minio/operator v0.0.0-20230228004026-ad024a9dffe5
2929
github.com/minio/pkg v1.6.5

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -655,10 +655,10 @@ github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLT
655655
github.com/minio/kes v0.22.3 h1:aSPW9uCMVaLax5POxvoQJxCU4MNo/KzMXA7WfmC/lRw=
656656
github.com/minio/kes v0.22.3/go.mod h1:wnhmdwWX2rpurNPKn3yDFImg2wuc7j3e+IU5rVkR9UY=
657657
github.com/minio/madmin-go v1.6.6/go.mod h1:ATvkBOLiP3av4D++2v1UEHC/QzsGtgXD5kYvvRYzdKs=
658-
github.com/minio/madmin-go/v2 v2.0.20 h1:EO2IIQsnaVM3ki/ONcW0Ry4UpDn5aa+/S1kLkHuDBs8=
659-
github.com/minio/madmin-go/v2 v2.0.20/go.mod h1:8bL1RMNkblIENFSgGYjeHrzUx9PxROb7OqfNuMU9ivE=
660-
github.com/minio/mc v0.0.0-20230421183052-0da22db3af01 h1:8o0xnhhmVlFDi+BMYib5EL5cgBD1z5M2Wk8RrZF6RFg=
661-
github.com/minio/mc v0.0.0-20230421183052-0da22db3af01/go.mod h1:v9AeUV4eaMpKCuNz0tk/MSGxvNs3duYvWUIxzpacxtc=
658+
github.com/minio/madmin-go/v2 v2.1.1 h1:qUdJP31MD3ThPOmvfRby0J5ZJdAw5XK67LxTkUI9DWA=
659+
github.com/minio/madmin-go/v2 v2.1.1/go.mod h1:8bL1RMNkblIENFSgGYjeHrzUx9PxROb7OqfNuMU9ivE=
660+
github.com/minio/mc v0.0.0-20230509151326-6050568e66a6 h1:bRJ1PnUl58yZ4gUlHyCWexmv6jxBBfq1pmjrt1PERHw=
661+
github.com/minio/mc v0.0.0-20230509151326-6050568e66a6/go.mod h1:qs/xdw+kX2neHHthlUZ5pHc0RUKwxlzcaZfAkEKpmSI=
662662
github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34=
663663
github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM=
664664
github.com/minio/minio-go/v7 v7.0.41/go.mod h1:nCrRzjoSUQh8hgKKtu3Y708OLvRLtuASMg2/nvmbarw=

restapi/admin_info.go

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -73,34 +73,11 @@ func GetAdminInfo(ctx context.Context, client MinioAdmin) (*UsageInfo, error) {
7373
// we are trimming uint64 to int64 this will report an incorrect measurement for numbers greater than
7474
// 9,223,372,036,854,775,807
7575

76-
var backendType string
77-
var rrSCParity float64
78-
var standardSCParity float64
79-
var onlineDrives float64
80-
var offlineDrives float64
81-
82-
if v, success := serverInfo.Backend.(map[string]interface{}); success {
83-
bt, ok := v["backendType"]
84-
if ok {
85-
backendType = bt.(string)
86-
}
87-
rp, ok := v["rrSCParity"]
88-
if ok {
89-
rrSCParity = rp.(float64)
90-
}
91-
sp, ok := v["standardSCParity"]
92-
if ok {
93-
standardSCParity = sp.(float64)
94-
}
95-
onDrives, ok := v["onlineDisks"]
96-
if ok {
97-
onlineDrives = onDrives.(float64)
98-
}
99-
offDrives, ok := v["offlineDisks"]
100-
if ok {
101-
offlineDrives = offDrives.(float64)
102-
}
103-
}
76+
backendType := serverInfo.Backend.Type
77+
rrSCParity := serverInfo.Backend.RRSCParity
78+
standardSCParity := serverInfo.Backend.StandardSCParity
79+
onlineDrives := serverInfo.Backend.OnlineDisks
80+
offlineDrives := serverInfo.Backend.OfflineDisks
10481

10582
var usedSpace int64
10683
// serverArray contains the serverProperties which describe the servers in the network
@@ -139,7 +116,7 @@ func GetAdminInfo(ctx context.Context, client MinioAdmin) (*UsageInfo, error) {
139116
}
140117

141118
backendData := &models.BackendProperties{
142-
BackendType: backendType,
119+
BackendType: string(backendType),
143120
RrSCParity: int64(rrSCParity),
144121
StandardSCParity: int64(standardSCParity),
145122
OnlineDrives: int64(onlineDrives),

restapi/admin_info_test.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ func (suite *AdminInfoTestSuite) SetupSuite() {
4949
Servers: []madmin.ServerProperties{{
5050
Disks: []madmin.Disk{{}},
5151
}},
52-
Backend: map[string]interface{}{
53-
"backendType": "mock",
54-
"rrSCParity": 0.0,
55-
"standardSCParity": 0.0,
56-
},
52+
Backend: madmin.ErasureBackend{Type: "mock"},
5753
}, nil
5854
}
5955
}

0 commit comments

Comments
 (0)