From 31386185fe7c2079ee412a411e536a5bf9e9eb25 Mon Sep 17 00:00:00 2001 From: Nicolas Lacasse Date: Thu, 17 May 2018 11:54:36 -0700 Subject: Push signal-delivery and wait into the sandbox. This is another step towards multi-container support. Previously, we delivered signals directly to the sandbox process (which then forwarded the signal to PID 1 inside the sandbox). Similarly, we waited on a container by waiting on the sandbox process itself. This approach will not work when there are multiple containers inside the sandbox, and we need to signal/wait on individual containers. This CL adds two new messages, ContainerSignal and ContainerWait. These messages include the id of the container to signal/wait. The controller inside the sandbox receives these messages and signals/waits on the appropriate process inside the sandbox. The container id is plumbed into the sandbox, but it currently is not used. We still end up signaling/waiting on PID 1 in all cases. Once we actually have multiple containers inside the sandbox, we will need to keep some sort of map of container id -> pid (or possibly pid namespace), and signal/kill the appropriate process for the container. PiperOrigin-RevId: 197028366 Change-Id: I07b4d5dc91ecd2affc1447e6b4bdd6b0b7360895 --- runsc/cmd/boot.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'runsc/cmd') diff --git a/runsc/cmd/boot.go b/runsc/cmd/boot.go index 0dad6da79..3bdc2ced0 100644 --- a/runsc/cmd/boot.go +++ b/runsc/cmd/boot.go @@ -111,21 +111,21 @@ func (b *Boot) Execute(_ context.Context, f *flag.FlagSet, args ...interface{}) } // Create the loader. - s, err := boot.New(spec, conf, b.controllerFD, b.ioFDs.GetArray(), b.console) + l, err := boot.New(spec, conf, b.controllerFD, b.ioFDs.GetArray(), b.console) if err != nil { Fatalf("error creating loader: %v", err) } - defer s.Destroy() + defer l.Destroy() // Wait for the start signal from runsc. - s.WaitForStartSignal() + l.WaitForStartSignal() // Run the application and wait for it to finish. - if err := s.Run(); err != nil { + if err := l.Run(); err != nil { Fatalf("error running sandbox: %v", err) } - ws := s.WaitExit() + ws := l.WaitExit() log.Infof("application exiting with %+v", ws) *waitStatus = syscall.WaitStatus(ws.Status()) return subcommands.ExitSuccess -- cgit v1.2.3