@@ -46,6 +46,7 @@ func (s *apiServer) CreateContainer(ctx context.Context, c *types.CreateContaine
4646 return nil , errors .New ("empty bundle path" )
4747 }
4848 e := & supervisor.StartTask {}
49+ e .WithContext (ctx )
4950 e .ID = c .Id
5051 e .BundlePath = c .BundlePath
5152 e .Stdin = c .Stdin
@@ -56,7 +57,6 @@ func (s *apiServer) CreateContainer(ctx context.Context, c *types.CreateContaine
5657 e .Runtime = c .Runtime
5758 e .RuntimeArgs = c .RuntimeArgs
5859 e .StartResponse = make (chan supervisor.StartResponse , 1 )
59- e .Ctx = ctx
6060 if c .Checkpoint != "" {
6161 e .CheckpointDir = c .CheckpointDir
6262 e .Checkpoint = & runtime.Checkpoint {
@@ -79,6 +79,7 @@ func (s *apiServer) CreateContainer(ctx context.Context, c *types.CreateContaine
7979
8080func (s * apiServer ) CreateCheckpoint (ctx context.Context , r * types.CreateCheckpointRequest ) (* types.CreateCheckpointResponse , error ) {
8181 e := & supervisor.CreateCheckpointTask {}
82+ e .WithContext (ctx )
8283 e .ID = r .Id
8384 e .CheckpointDir = r .CheckpointDir
8485 e .Checkpoint = & runtime.Checkpoint {
@@ -102,6 +103,7 @@ func (s *apiServer) DeleteCheckpoint(ctx context.Context, r *types.DeleteCheckpo
102103 return nil , errors .New ("checkpoint name cannot be empty" )
103104 }
104105 e := & supervisor.DeleteCheckpointTask {}
106+ e .WithContext (ctx )
105107 e .ID = r .Id
106108 e .CheckpointDir = r .CheckpointDir
107109 e .Checkpoint = & runtime.Checkpoint {
@@ -116,6 +118,7 @@ func (s *apiServer) DeleteCheckpoint(ctx context.Context, r *types.DeleteCheckpo
116118
117119func (s * apiServer ) ListCheckpoint (ctx context.Context , r * types.ListCheckpointRequest ) (* types.ListCheckpointResponse , error ) {
118120 e := & supervisor.GetContainersTask {}
121+ e .WithContext (ctx )
119122 s .sv .SendTask (e )
120123 if err := <- e .ErrorCh (); err != nil {
121124 return nil , err
@@ -150,6 +153,7 @@ func (s *apiServer) ListCheckpoint(ctx context.Context, r *types.ListCheckpointR
150153
151154func (s * apiServer ) Signal (ctx context.Context , r * types.SignalRequest ) (* types.SignalResponse , error ) {
152155 e := & supervisor.SignalTask {}
156+ e .WithContext (ctx )
153157 e .ID = r .Id
154158 e .PID = r .Pid
155159 e .Signal = syscall .Signal (int (r .Signal ))
@@ -167,6 +171,7 @@ func (s *apiServer) State(ctx context.Context, r *types.StateRequest) (*types.St
167171 }
168172
169173 e := & supervisor.GetContainersTask {}
174+ e .WithContext (ctx )
170175 e .ID = r .Id
171176 e .GetState = getState
172177 s .sv .SendTask (e )
@@ -253,6 +258,7 @@ func toUint32(its []int) []uint32 {
253258
254259func (s * apiServer ) UpdateContainer (ctx context.Context , r * types.UpdateContainerRequest ) (* types.UpdateContainerResponse , error ) {
255260 e := & supervisor.UpdateTask {}
261+ e .WithContext (ctx )
256262 e .ID = r .Id
257263 e .State = runtime .State (r .Status )
258264 if r .Resources != nil {
@@ -304,6 +310,7 @@ func (s *apiServer) UpdateContainer(ctx context.Context, r *types.UpdateContaine
304310
305311func (s * apiServer ) UpdateProcess (ctx context.Context , r * types.UpdateProcessRequest ) (* types.UpdateProcessResponse , error ) {
306312 e := & supervisor.UpdateProcessTask {}
313+ e .WithContext (ctx )
307314 e .ID = r .Id
308315 e .PID = r .Pid
309316 e .Height = int (r .Height )
@@ -482,6 +489,7 @@ func getSystemCPUUsage() (uint64, error) {
482489
483490func (s * apiServer ) Stats (ctx context.Context , r * types.StatsRequest ) (* types.StatsResponse , error ) {
484491 e := & supervisor.StatsTask {}
492+ e .WithContext (ctx )
485493 e .ID = r .Id
486494 e .Stat = make (chan * runtime.Stat , 1 )
487495 s .sv .SendTask (e )
0 commit comments