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
import (
"errors"
"net/url"
"time"
@ -204,7 +205,10 @@ func retryFormattingDisks(firstDisk bool, endpoints []*url.URL, storageDisks []S
defer close(doneCh)
// 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`.
formatConfigs, sErrs := loadAllFormats(storageDisks)
if retryCounter > 5 {
@ -259,8 +263,10 @@ func retryFormattingDisks(firstDisk bool, endpoints []*url.URL, storageDisks []S
return genericFormatCheck(formatConfigs, sErrs)
} // else initialize the format for FS.
return initFormatFS(storageDisks[0])
} // Return here.
return nil
case <-globalServiceDoneCh:
return errors.New("Initializing data volumes gracefully stopped.")
}
}
}
// Initialize storage disks based on input arguments.

Loading…
Cancel
Save