Merge pull request #2763 from hashicorp/f-bad-state-help

Add more logging to restore state errors
This commit is contained in:
Michael Schurter 2017-07-03 14:45:03 -07:00 committed by GitHub
commit 56a6f8ca8a
1 changed files with 10 additions and 1 deletions

View File

@ -299,7 +299,16 @@ func NewClient(cfg *config.Config, consulCatalog consul.CatalogAPI, consulServic
// Restore the state
if err := c.restoreState(); err != nil {
return nil, fmt.Errorf("failed to restore state: %v", err)
logger.Printf("[ERR] client: failed to restore state: %v", err)
logger.Printf("[ERR] client: Nomad is unable to start due to corrupt state. "+
"The safest way to proceed is to manually stop running task processes "+
"and remove Nomad's state (%q) and alloc (%d) directories before "+
"restarting. Lost allocations will be rescheduled.",
c.config.StateDir, c.config.AllocDir)
logger.Printf("[ERR] client: Corrupt state is often caused by a bug. Please " +
"report as much information as possible to " +
"https://github.com/hashicorp/nomad/issues")
return nil, fmt.Errorf("failed to restore state")
}
// Register and then start heartbeating to the servers.