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>
This commit is contained in:
Anis Eleuch
2023-05-09 18:49:51 +01:00
committed by GitHub
parent f78f838ed9
commit c117601e53
4 changed files with 13 additions and 40 deletions

View File

@@ -73,34 +73,11 @@ func GetAdminInfo(ctx context.Context, client MinioAdmin) (*UsageInfo, error) {
// we are trimming uint64 to int64 this will report an incorrect measurement for numbers greater than
// 9,223,372,036,854,775,807
var backendType string
var rrSCParity float64
var standardSCParity float64
var onlineDrives float64
var offlineDrives float64
if v, success := serverInfo.Backend.(map[string]interface{}); success {
bt, ok := v["backendType"]
if ok {
backendType = bt.(string)
}
rp, ok := v["rrSCParity"]
if ok {
rrSCParity = rp.(float64)
}
sp, ok := v["standardSCParity"]
if ok {
standardSCParity = sp.(float64)
}
onDrives, ok := v["onlineDisks"]
if ok {
onlineDrives = onDrives.(float64)
}
offDrives, ok := v["offlineDisks"]
if ok {
offlineDrives = offDrives.(float64)
}
}
backendType := serverInfo.Backend.Type
rrSCParity := serverInfo.Backend.RRSCParity
standardSCParity := serverInfo.Backend.StandardSCParity
onlineDrives := serverInfo.Backend.OnlineDisks
offlineDrives := serverInfo.Backend.OfflineDisks
var usedSpace int64
// serverArray contains the serverProperties which describe the servers in the network
@@ -139,7 +116,7 @@ func GetAdminInfo(ctx context.Context, client MinioAdmin) (*UsageInfo, error) {
}
backendData := &models.BackendProperties{
BackendType: backendType,
BackendType: string(backendType),
RrSCParity: int64(rrSCParity),
StandardSCParity: int64(standardSCParity),
OnlineDrives: int64(onlineDrives),

View File

@@ -49,11 +49,7 @@ func (suite *AdminInfoTestSuite) SetupSuite() {
Servers: []madmin.ServerProperties{{
Disks: []madmin.Disk{{}},
}},
Backend: map[string]interface{}{
"backendType": "mock",
"rrSCParity": 0.0,
"standardSCParity": 0.0,
},
Backend: madmin.ErasureBackend{Type: "mock"},
}, nil
}
}