api/execution: remove ProcessID from rpc calls

Now that the shim handles all container's processes the system pid is
sufficient.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
Kenfe-Mickael Laventure 2017-02-02 15:36:10 -08:00
parent 40b0b211b7
commit 6f9eda1134
9 changed files with 151 additions and 241 deletions

View file

@ -29,11 +29,11 @@ var deleteCommand = cli.Command{
return fmt.Errorf("container id must be provided")
}
pid := context.String("pid")
if pid != "" {
pid := uint32(context.Int64("pid"))
if pid != 0 {
_, err = executionService.DeleteProcess(gocontext.Background(), &execution.DeleteProcessRequest{
ContainerID: id,
ProcessID: pid,
Pid: pid,
})
if err != nil {
return err

View file

@ -3,6 +3,7 @@ package main
import (
"os"
"path/filepath"
"time"
gocontext "context"
@ -18,10 +19,6 @@ var execCommand = cli.Command{
Name: "id, i",
Usage: "target container id",
},
cli.StringFlag{
Name: "pid, p",
Usage: "new process id",
},
cli.StringFlag{
Name: "cwd, c",
Usage: "current working directory for the process",
@ -42,7 +39,7 @@ var execCommand = cli.Command{
return err
}
id := context.String("id")
id := time.Now().Format("2006-_2-01_15:04:05")
tmpDir, err := getTempDir(id)
if err != nil {
return err
@ -52,7 +49,6 @@ var execCommand = cli.Command{
sOpts := &execution.StartProcessRequest{
ContainerID: id,
Process: &execution.Process{
ID: context.String("pid"),
Cwd: context.String("cwd"),
Terminal: context.Bool("tty"),
Args: context.Args(),
@ -76,7 +72,7 @@ var execCommand = cli.Command{
_, err = executionService.DeleteProcess(gocontext.Background(), &execution.DeleteProcessRequest{
ContainerID: id,
ProcessID: sr.Process.ID,
Pid: sr.Process.Pid,
})
if err != nil {
return err

View file

@ -28,7 +28,7 @@ var inspectCommand = cli.Command{
return err
}
listProcResponse, err := executionService.ListProcesses(gocontext.Background(),
&execution.ListProcessesRequest{ID: id})
&execution.ListProcessesRequest{ContainerID: id})
if err != nil {
return err
}

View file

@ -25,7 +25,7 @@ var listCommand = cli.Command{
fmt.Printf("ID\tSTATUS\tPROCS\tBUNDLE\n")
for _, c := range listResponse.Containers {
listProcResponse, err := executionService.ListProcesses(gocontext.Background(),
&execution.ListProcessesRequest{ID: c.ID})
&execution.ListProcessesRequest{ContainerID: c.ID})
if err != nil {
return err
}

View file

@ -118,7 +118,7 @@ var runCommand = cli.Command{
break eventLoop
}
if e.ID == cr.Container.ID && e.PID == cr.InitProcess.ID {
if e.ID == cr.Container.ID && e.PID == cr.InitProcess.Pid {
ec = e.StatusCode
break eventLoop
}