Move exec and checkpoint to process state
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
cf28969328
commit
d317f71ac2
5 changed files with 26 additions and 31 deletions
|
@ -150,7 +150,6 @@ func (c *container) Start(checkpoint string, s Stdio) (Process, error) {
|
|||
return nil, err
|
||||
}
|
||||
cmd := exec.Command("containerd-shim",
|
||||
"-checkpoint", checkpoint,
|
||||
c.id, c.bundle,
|
||||
)
|
||||
cmd.Dir = processRoot
|
||||
|
@ -162,6 +161,7 @@ func (c *container) Start(checkpoint string, s Stdio) (Process, error) {
|
|||
return nil, err
|
||||
}
|
||||
config := &processConfig{
|
||||
checkpoint: checkpoint,
|
||||
root: processRoot,
|
||||
id: InitProcessID,
|
||||
c: c,
|
||||
|
@ -189,7 +189,6 @@ func (c *container) Exec(pid string, spec specs.Process, s Stdio) (Process, erro
|
|||
return nil, err
|
||||
}
|
||||
cmd := exec.Command("containerd-shim",
|
||||
"-exec",
|
||||
c.id, c.bundle,
|
||||
)
|
||||
cmd.Dir = processRoot
|
||||
|
@ -197,6 +196,7 @@ func (c *container) Exec(pid string, spec specs.Process, s Stdio) (Process, erro
|
|||
Setpgid: true,
|
||||
}
|
||||
config := &processConfig{
|
||||
exec: true,
|
||||
id: pid,
|
||||
root: processRoot,
|
||||
c: c,
|
||||
|
|
|
@ -47,6 +47,8 @@ type processConfig struct {
|
|||
spec *specs.LinuxSpec
|
||||
c *container
|
||||
stdio Stdio
|
||||
exec bool
|
||||
checkpoint string
|
||||
}
|
||||
|
||||
func newProcess(config *processConfig) (*process, error) {
|
||||
|
@ -67,12 +69,14 @@ func newProcess(config *processConfig) (*process, error) {
|
|||
}
|
||||
defer f.Close()
|
||||
if err := json.NewEncoder(f).Encode(ProcessState{
|
||||
Process: config.processSpec,
|
||||
RootUID: uid,
|
||||
RootGID: gid,
|
||||
Stdin: config.stdio.Stdin,
|
||||
Stdout: config.stdio.Stdout,
|
||||
Stderr: config.stdio.Stderr,
|
||||
Process: config.processSpec,
|
||||
Exec: config.exec,
|
||||
Checkpoint: config.checkpoint,
|
||||
RootUID: uid,
|
||||
RootGID: gid,
|
||||
Stdin: config.stdio.Stdin,
|
||||
Stdout: config.stdio.Stdout,
|
||||
Stderr: config.stdio.Stderr,
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -44,11 +44,13 @@ type state struct {
|
|||
|
||||
type ProcessState struct {
|
||||
specs.Process
|
||||
RootUID int `json:"rootUID"`
|
||||
RootGID int `json:"rootGID"`
|
||||
Stdin string `json:"containerdStdin"`
|
||||
Stdout string `json:"containerdStdout"`
|
||||
Stderr string `json:"containerdStderr"`
|
||||
Exec bool `json:"exec"`
|
||||
Checkpoint string `json:"checkpoint"`
|
||||
RootUID int `json:"rootUID"`
|
||||
RootGID int `json:"rootGID"`
|
||||
Stdin string `json:"containerdStdin"`
|
||||
Stdout string `json:"containerdStdout"`
|
||||
Stderr string `json:"containerdStderr"`
|
||||
}
|
||||
|
||||
type Stat struct {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue