fix: retain the previous UUID for newly replaced drives (#10759)

only newly replaced drives get the new `format.json`,
this avoids disks reloading their in-memory reference
format, ensures that drives are online without
reloading the in-memory reference format.

keeping reference format in-tact means UUIDs
never change once they are formatted.
This commit is contained in:
Harshavardhana
2020-10-26 10:29:29 -07:00
committed by GitHub
parent 649035677f
commit 029758cb20
11 changed files with 100 additions and 274 deletions

View File

@@ -57,6 +57,18 @@ func isObjectDir(object string, size int64) bool {
return HasSuffix(object, SlashSeparator) && size == 0
}
func newStorageAPIWithoutHealthCheck(endpoint Endpoint) (storage StorageAPI, err error) {
if endpoint.IsLocal {
storage, err := newXLStorage(endpoint)
if err != nil {
return nil, err
}
return &xlStorageDiskIDCheck{storage: storage}, nil
}
return newStorageRESTClient(endpoint, false), nil
}
// Depending on the disk type network or local, initialize storage API.
func newStorageAPI(endpoint Endpoint) (storage StorageAPI, err error) {
if endpoint.IsLocal {
@@ -67,7 +79,7 @@ func newStorageAPI(endpoint Endpoint) (storage StorageAPI, err error) {
return &xlStorageDiskIDCheck{storage: storage}, nil
}
return newStorageRESTClient(endpoint), nil
return newStorageRESTClient(endpoint, true), nil
}
// Cleanup a directory recursively.