mirror of
https://github.com/minio/minio.git
synced 2025-11-21 02:09:08 -05:00
XL: Handle object layer initialization properly.
Initialization when disk was down the network disk reported an incorrect error rather than errDiskNotFound. This resulted in incorrect error handling during prepInitStorage() stage. Fixes #2577
This commit is contained in:
@@ -297,12 +297,15 @@ func isDistributedSetup(disks []string) (isDist bool) {
|
||||
// Format disks before initialization object layer.
|
||||
func formatDisks(disks, ignoredDisks []string) error {
|
||||
storageDisks, err := waitForFormattingDisks(disks, ignoredDisks)
|
||||
for i := range storageDisks {
|
||||
switch storage := storageDisks[i].(type) {
|
||||
for _, storage := range storageDisks {
|
||||
if storage == nil {
|
||||
continue
|
||||
}
|
||||
switch store := storage.(type) {
|
||||
// Closing associated TCP connections since
|
||||
// []StorageAPI is garbage collected eventually.
|
||||
case networkStorage:
|
||||
storage.rpcClient.Close()
|
||||
store.rpcClient.Close()
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
@@ -310,13 +313,13 @@ func formatDisks(disks, ignoredDisks []string) error {
|
||||
}
|
||||
if isLocalStorage(disks[0]) {
|
||||
// notify every one else that they can try init again.
|
||||
for i := range storageDisks {
|
||||
switch storage := storageDisks[i].(type) {
|
||||
for _, storage := range storageDisks {
|
||||
switch store := storage.(type) {
|
||||
// Closing associated TCP connections since
|
||||
// []StorageAPI is garage collected eventually.
|
||||
case networkStorage:
|
||||
var reply GenericReply
|
||||
_ = storage.rpcClient.Call("Storage.TryInitHandler", &GenericArgs{}, &reply)
|
||||
_ = store.rpcClient.Call("Storage.TryInitHandler", &GenericArgs{}, &reply)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user