Preserve errors returned by diskInfo to detect disk errors (#9727)

This PR basically reverts #9720 and re-implements it differently
This commit is contained in:
Harshavardhana
2020-05-28 13:03:04 -07:00
committed by GitHub
parent b330c2c57e
commit b2db8123ec
20 changed files with 152 additions and 134 deletions

View File

@@ -177,19 +177,11 @@ func (client *storageRESTClient) CrawlAndGetDataUsage(ctx context.Context, cache
}
func (client *storageRESTClient) GetDiskID() (string, error) {
respBody, err := client.call(storageRESTMethodGetDiskID, nil, nil, -1)
if err != nil {
// Ignore when other nodes does not support GetDiskID call, this check
// can be removed when the storage API version is bumped.
if strings.Contains(err.Error(), "404 page not found") {
return client.diskID, nil
}
return "", err
}
defer http.DrainBody(respBody)
var s string
err = gob.NewDecoder(respBody).Decode(&s)
return s, err
// This call should never be over the network, this is always
// a cached value - caller should make sure to use this
// function on a fresh disk or make sure to look at the error
// from a different networked call to validate the GetDiskID()
return client.diskID, nil
}
func (client *storageRESTClient) SetDiskID(id string) {