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

Commit dbb9e2f

Browse files
committed
agent: fix kata agent SignalProcess ExecId
Kata Agent uses empty ExecId to signal all processes of a container. Signed-off-by: Peng Tao <[email protected]>
1 parent 691cf49 commit dbb9e2f

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

agent/hyperstart.go

+5
Original file line numberDiff line numberDiff line change
@@ -982,6 +982,11 @@ func (h *jsonBasedHyperstart) ExecProcess(container, process string, user *runva
982982
}
983983

984984
func (h *jsonBasedHyperstart) SignalProcess(container, process string, signal syscall.Signal) error {
985+
// Kata agent API requires process == "" to kill all processes in a container
986+
// Convert it back to hyperstart semantics.
987+
if process == "" {
988+
process = "init"
989+
}
985990
if h.vmAPIVersion <= 4242 {
986991
if process == "init" {
987992
return h.hyperstartCommand(hyperstartapi.INIT_KILLCONTAINER, hyperstartapi.KillCommand{

agent/kata.go

+4
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,10 @@ func (kata *kataAgent) ExecProcess(container, process string, user *runvapi.User
253253
}
254254

255255
func (kata *kataAgent) SignalProcess(container, process string, signal syscall.Signal) error {
256+
// Kata Agent uses empty ExecId to signal all processes of a container
257+
if process == "init" {
258+
process = ""
259+
}
256260
_, err := kata.agent.SignalProcess(context.Background(), &kagenta.SignalProcessRequest{
257261
ContainerId: container,
258262
ExecId: process,

0 commit comments

Comments
 (0)