Move libcontainer helper to executor package
This commit is contained in:
parent
e0c7063697
commit
18993421f2
|
@ -19,7 +19,6 @@ import (
|
|||
multierror "github.com/hashicorp/go-multierror"
|
||||
"github.com/hashicorp/nomad/client/stats"
|
||||
cstructs "github.com/hashicorp/nomad/client/structs"
|
||||
"github.com/hashicorp/nomad/helper/discover"
|
||||
shelpers "github.com/hashicorp/nomad/helper/stats"
|
||||
"github.com/hashicorp/nomad/helper/uuid"
|
||||
"github.com/hashicorp/nomad/nomad/structs"
|
||||
|
@ -99,11 +98,6 @@ func NewExecutorWithIsolation(logger hclog.Logger) Executor {
|
|||
// Launch creates a new container in libcontainer and starts a new process with it
|
||||
func (l *LibcontainerExecutor) Launch(command *ExecCommand) (*ProcessState, error) {
|
||||
l.logger.Debug("launching command", "command", command.Cmd, "args", strings.Join(command.Args, " "))
|
||||
// Find the nomad executable to launch the executor process with
|
||||
bin, err := discover.NomadExecutable()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to find the nomad binary: %v", err)
|
||||
}
|
||||
|
||||
if command.Resources == nil {
|
||||
command.Resources = &drivers.Resources{
|
||||
|
@ -126,7 +120,7 @@ func (l *LibcontainerExecutor) Launch(command *ExecCommand) (*ProcessState, erro
|
|||
factory, err := libcontainer.New(
|
||||
path.Join(command.TaskDir, "../alloc/container"),
|
||||
libcontainer.Cgroupfs,
|
||||
libcontainer.InitArgs(bin, "libcontainer-shim"),
|
||||
libcontainer.InitArgs(os.Args[0], "libcontainer-shim"),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create factory: %v", err)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package main
|
||||
package executor
|
||||
|
||||
import (
|
||||
"os"
|
Loading…
Reference in a new issue