diff --git a/client/allocrunnerv2/alloc_runner.go b/client/allocrunnerv2/alloc_runner.go index 60a6fce30..533d036ee 100644 --- a/client/allocrunnerv2/alloc_runner.go +++ b/client/allocrunnerv2/alloc_runner.go @@ -5,6 +5,7 @@ import ( "path/filepath" "sync" + "github.com/boltdb/bolt" log "github.com/hashicorp/go-hclog" "github.com/hashicorp/nomad/client/allocdir" "github.com/hashicorp/nomad/client/allocrunner" @@ -31,9 +32,12 @@ type allocRunner struct { alloc *structs.Allocation allocLock sync.RWMutex + //XXX implement for local state // state captures the state of the alloc runner state *state.State + stateDB *bolt.DB + // allocDir is used to build the allocations directory structure. allocDir *allocdir.AllocDir @@ -56,6 +60,7 @@ func NewAllocRunner(config *Config) *allocRunner { tasks: make(map[string]*taskrunner.TaskRunner), waitCh: make(chan struct{}), updateCh: make(chan *structs.Allocation), + stateDB: config.StateDB, } // Create alloc dir @@ -158,6 +163,7 @@ func (ar *allocRunner) runTask(alloc *structs.Allocation, task *structs.Task) er Task: task, TaskDir: ar.allocDir.NewTaskDir(task.Name), Logger: ar.logger, + StateDB: ar.stateDB, } tr, err := taskrunner.NewTaskRunner(config) if err != nil { diff --git a/client/client.go b/client/client.go index 2c690fbb5..64e4e1d00 100644 --- a/client/client.go +++ b/client/client.go @@ -1926,10 +1926,10 @@ func (c *Client) addAlloc(alloc *structs.Allocation, migrateToken string) error c.configLock.RLock() arConf := &allocrunnerv2.Config{ + Alloc: alloc, Logger: logger, ClientConfig: c.config, - Alloc: alloc, - StateDB: nil, //FIXME ? + StateDB: c.stateDB, } c.configLock.RUnlock()