add support for speedtest drive (#14182)

This commit is contained in:
Sidhartha Mani
2022-02-01 22:38:05 -08:00
committed by GitHub
parent a4e1de93a7
commit d7df6bc738
10 changed files with 497 additions and 143 deletions

View File

@@ -1611,6 +1611,39 @@ func (sys *NotificationSys) Speedtest(ctx context.Context, size int,
return results
}
// DriveSpeedTest - Drive performance information
func (sys *NotificationSys) DriveSpeedTest(ctx context.Context, opts madmin.DriveSpeedTestOpts) chan madmin.DriveSpeedTestResult {
ch := make(chan madmin.DriveSpeedTestResult)
var wg sync.WaitGroup
for _, client := range sys.peerClients {
if client == nil {
continue
}
wg.Add(1)
go func(client *peerRESTClient) {
defer wg.Done()
resp, err := client.DriveSpeedTest(ctx, opts)
if err != nil {
resp.Error = err.Error()
}
ch <- resp
reqInfo := (&logger.ReqInfo{}).AppendTags("remotePeer", client.host.String())
ctx := logger.SetReqInfo(GlobalContext, reqInfo)
logger.LogIf(ctx, err)
}(client)
}
go func() {
wg.Wait()
close(ch)
}()
return ch
}
// ReloadSiteReplicationConfig - tells all peer minio nodes to reload the
// site-replication configuration.
func (sys *NotificationSys) ReloadSiteReplicationConfig(ctx context.Context) []error {