Skip to content
This repository has been archived by the owner on Feb 8, 2021. It is now read-only.

Commit

Permalink
agent: fix kata agent SignalProcess ExecId
Browse files Browse the repository at this point in the history
Kata Agent uses empty ExecId to signal all processes of a container.

Signed-off-by: Peng Tao <[email protected]>
  • Loading branch information
bergwolf committed Feb 11, 2018
1 parent 691cf49 commit dbb9e2f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions agent/hyperstart.go
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,11 @@ func (h *jsonBasedHyperstart) ExecProcess(container, process string, user *runva
}

func (h *jsonBasedHyperstart) SignalProcess(container, process string, signal syscall.Signal) error {
// Kata agent API requires process == "" to kill all processes in a container
// Convert it back to hyperstart semantics.
if process == "" {
process = "init"
}
if h.vmAPIVersion <= 4242 {
if process == "init" {
return h.hyperstartCommand(hyperstartapi.INIT_KILLCONTAINER, hyperstartapi.KillCommand{
Expand Down
4 changes: 4 additions & 0 deletions agent/kata.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,10 @@ func (kata *kataAgent) ExecProcess(container, process string, user *runvapi.User
}

func (kata *kataAgent) SignalProcess(container, process string, signal syscall.Signal) error {
// Kata Agent uses empty ExecId to signal all processes of a container
if process == "init" {
process = ""
}
_, err := kata.agent.SignalProcess(context.Background(), &kagenta.SignalProcessRequest{
ContainerId: container,
ExecId: process,
Expand Down

0 comments on commit dbb9e2f

Please sign in to comment.