pass statedb into allocrunnerv2

This commit is contained in:
Michael Schurter 2018-07-10 21:21:12 -07:00
parent 582c76a420
commit 4f43ff5c51
2 changed files with 8 additions and 2 deletions

View File

@ -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 {

View File

@ -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()