pass statedb into allocrunnerv2
This commit is contained in:
parent
582c76a420
commit
4f43ff5c51
|
@ -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 {
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in New Issue