Quit initializing disks process when term signal is invoked (#3163)

master
Anis Elleuch 8 years ago committed by Harshavardhana
parent d9674f7524
commit e6965ca066
  1. 12
      cmd/prepare-storage.go

@ -17,6 +17,7 @@
package cmd package cmd
import ( import (
"errors"
"net/url" "net/url"
"time" "time"
@ -204,7 +205,10 @@ func retryFormattingDisks(firstDisk bool, endpoints []*url.URL, storageDisks []S
defer close(doneCh) defer close(doneCh)
// Wait on the jitter retry loop. // Wait on the jitter retry loop.
for retryCounter := range newRetryTimer(time.Second, time.Second*30, MaxJitter, doneCh) { retryTimerCh := newRetryTimer(time.Second, time.Second*30, MaxJitter, doneCh)
for {
select {
case retryCounter := <-retryTimerCh:
// Attempt to load all `format.json`. // Attempt to load all `format.json`.
formatConfigs, sErrs := loadAllFormats(storageDisks) formatConfigs, sErrs := loadAllFormats(storageDisks)
if retryCounter > 5 { if retryCounter > 5 {
@ -259,8 +263,10 @@ func retryFormattingDisks(firstDisk bool, endpoints []*url.URL, storageDisks []S
return genericFormatCheck(formatConfigs, sErrs) return genericFormatCheck(formatConfigs, sErrs)
} // else initialize the format for FS. } // else initialize the format for FS.
return initFormatFS(storageDisks[0]) return initFormatFS(storageDisks[0])
} // Return here. case <-globalServiceDoneCh:
return nil return errors.New("Initializing data volumes gracefully stopped.")
}
}
} }
// Initialize storage disks based on input arguments. // Initialize storage disks based on input arguments.

Loading…
Cancel
Save