remove SetDiskLoc() rely on the endpoint values instead (#19475)

the disk location never changes in the lifetime of a
MinIO cluster, even if it did validate this close to the
disk instead at the higher layer.

Return appropriate errors indicating an invalid drive, so
that the drive is not recognized as part of a valid
drive.
This commit is contained in:
Harshavardhana
2024-04-11 10:45:28 -07:00
committed by GitHub
parent aa8d25797b
commit 074febd9e1
9 changed files with 57 additions and 262 deletions

View File

@@ -163,21 +163,11 @@ type storageRESTClient struct {
formatMutex sync.RWMutex
diskInfoCache *cachevalue.Cache[DiskInfo]
// Indexes, will be -1 until assigned a set.
poolIndex, setIndex, diskIndex int
}
// Retrieve location indexes.
func (client *storageRESTClient) GetDiskLoc() (poolIdx, setIdx, diskIdx int) {
return client.poolIndex, client.setIndex, client.diskIndex
}
// Set location indexes.
func (client *storageRESTClient) SetDiskLoc(poolIdx, setIdx, diskIdx int) {
client.poolIndex = poolIdx
client.setIndex = setIdx
client.diskIndex = diskIdx
return client.endpoint.PoolIdx, client.endpoint.SetIdx, client.endpoint.DiskIdx
}
// Wrapper to restClient.Call to handle network errors, in case of network error the connection is makred disconnected