File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 "context"
88 "fmt"
99 "maps"
10+ "os"
1011 "sync"
1112 "time"
1213
@@ -472,6 +473,13 @@ func (ar *allocRunner) GetAllocDir() allocdir.Interface {
472473// Restore state from database. Must be called after NewAllocRunner but before
473474// Run.
474475func (ar * allocRunner ) Restore () error {
476+ // We should not carry on to restoring an allocation whose directory is
477+ // inaccessible. This can happen if allocation storage is ephemeral, e.g.
478+ // a tmpfs or cloud local SSDs.
479+ if _ , err := os .Stat (ar .allocDir .AllocDirPath ()); err != nil {
480+ return fmt .Errorf ("allocation directory is inacessible: %w" , err )
481+ }
482+
475483 // Retrieve deployment status to avoid reseting it across agent
476484 // restarts. Once a deployment status is set Nomad no longer monitors
477485 // alloc health, so we must persist deployment state across restarts.
You can’t perform that action at this time.
0 commit comments