@@ -83,9 +83,7 @@ func (c *calcium) createContainerWithMemoryPrior(specs types.Specs, opts *types.
83
83
84
84
func (c * calcium ) removeMemoryPodFailedContainer (id string , node * types.Node , nodeInfo types.NodeInfo , opts * types.DeployOptions ) {
85
85
defer c .store .UpdateNodeMem (opts .Podname , nodeInfo .Name , opts .Memory , "+" )
86
- ctx , cancel := context .WithTimeout (context .Background (), c .config .Timeout .CreateContainer )
87
- defer cancel ()
88
- if err := node .Engine .ContainerRemove (ctx , id , enginetypes.ContainerRemoveOptions {}); err != nil {
86
+ if err := node .Engine .ContainerRemove (context .Background (), id , enginetypes.ContainerRemoveOptions {}); err != nil {
89
87
log .Errorf ("[RemoveMemoryPodFailedContainer] Error during remove failed container %v" , err )
90
88
}
91
89
}
@@ -127,9 +125,7 @@ func (c *calcium) doCreateContainerWithMemoryPrior(nodeInfo types.NodeInfo, spec
127
125
}
128
126
129
127
//create container
130
- ctx , cancel := context .WithTimeout (context .Background (), c .config .Timeout .CreateContainer )
131
- defer cancel ()
132
- container , err := node .Engine .ContainerCreate (ctx , config , hostConfig , networkConfig , containerName )
128
+ container , err := node .Engine .ContainerCreate (context .Background (), config , hostConfig , networkConfig , containerName )
133
129
if err != nil {
134
130
log .Errorf ("[CreateContainerWithMemoryPrior] Error during ContainerCreate, %v" , err )
135
131
ms [i ].Error = err .Error ()
@@ -165,9 +161,7 @@ func (c *calcium) doCreateContainerWithMemoryPrior(nodeInfo types.NodeInfo, spec
165
161
continue
166
162
}
167
163
}
168
- ctxStart , cancelStart := context .WithTimeout (context .Background (), c .config .Timeout .CreateContainer )
169
- defer cancelStart ()
170
- err = node .Engine .ContainerStart (ctxStart , container .ID , enginetypes.ContainerStartOptions {})
164
+ err = node .Engine .ContainerStart (context .Background (), container .ID , enginetypes.ContainerStartOptions {})
171
165
if err != nil {
172
166
log .Errorf ("[CreateContainerWithMemoryPrior] Error during ContainerStart, %v" , err )
173
167
ms [i ].Error = err .Error ()
@@ -178,9 +172,7 @@ func (c *calcium) doCreateContainerWithMemoryPrior(nodeInfo types.NodeInfo, spec
178
172
// TODO
179
173
// if network manager uses our own, then connect must be called after container starts
180
174
// here
181
- ctxInspect , cancelInspect := context .WithTimeout (context .Background (), c .config .Timeout .CreateContainer )
182
- defer cancelInspect ()
183
- info , err := node .Engine .ContainerInspect (ctxInspect , container .ID )
175
+ info , err := node .Engine .ContainerInspect (context .Background (), container .ID )
184
176
if err != nil {
185
177
log .Errorf ("[CreateContainerWithMemoryPrior] Error during ContainerInspect, %v" , err )
186
178
ms [i ].Error = err .Error ()
@@ -190,7 +182,7 @@ func (c *calcium) doCreateContainerWithMemoryPrior(nodeInfo types.NodeInfo, spec
190
182
ms [i ].ContainerID = info .ID
191
183
192
184
// after start
193
- if err := runExec (node .Engine , info , AFTER_START , c . config . Timeout . CreateContainer ); err != nil {
185
+ if err := runExec (node .Engine , info , AFTER_START ); err != nil {
194
186
log .Errorf ("[CreateContainerWithMemoryPrior] Run exec at %s error: %v" , AFTER_START , err )
195
187
}
196
188
@@ -259,9 +251,7 @@ func (c *calcium) createContainerWithCPUPrior(specs types.Specs, opts *types.Dep
259
251
260
252
func (c * calcium ) removeCPUPodFailedContainer (id string , node * types.Node , quota types.CPUMap ) {
261
253
defer c .releaseQuota (node , quota )
262
- ctx , cancel := context .WithTimeout (context .Background (), c .config .Timeout .CreateContainer )
263
- defer cancel ()
264
- if err := node .Engine .ContainerRemove (ctx , id , enginetypes.ContainerRemoveOptions {}); err != nil {
254
+ if err := node .Engine .ContainerRemove (context .Background (), id , enginetypes.ContainerRemoveOptions {}); err != nil {
265
255
log .Errorf ("[RemoveCPUPodFailedContainer] Error during remove failed container %v" , err )
266
256
}
267
257
}
@@ -301,9 +291,7 @@ func (c *calcium) doCreateContainerWithCPUPrior(nodeName string, cpuMap []types.
301
291
}
302
292
303
293
// create container
304
- ctxCreate , cancelCreate := context .WithTimeout (context .Background (), c .config .Timeout .CreateContainer )
305
- defer cancelCreate ()
306
- container , err := node .Engine .ContainerCreate (ctxCreate , config , hostConfig , networkConfig , containerName )
294
+ container , err := node .Engine .ContainerCreate (context .Background (), config , hostConfig , networkConfig , containerName )
307
295
if err != nil {
308
296
log .Errorf ("[CreateContainerWithCPUPrior] Error when creating container, %v" , err )
309
297
ms [i ].Error = err .Error ()
@@ -341,9 +329,7 @@ func (c *calcium) doCreateContainerWithCPUPrior(nodeName string, cpuMap []types.
341
329
continue
342
330
}
343
331
}
344
- ctxStart , cancelStart := context .WithTimeout (context .Background (), c .config .Timeout .CreateContainer )
345
- defer cancelStart ()
346
- err = node .Engine .ContainerStart (ctxStart , container .ID , enginetypes.ContainerStartOptions {})
332
+ err = node .Engine .ContainerStart (context .Background (), container .ID , enginetypes.ContainerStartOptions {})
347
333
if err != nil {
348
334
log .Errorf ("[CreateContainerWithCPUPrior] Error when starting container, %v" , err )
349
335
ms [i ].Error = err .Error ()
@@ -354,9 +340,7 @@ func (c *calcium) doCreateContainerWithCPUPrior(nodeName string, cpuMap []types.
354
340
// TODO
355
341
// if network manager uses our own, then connect must be called after container starts
356
342
// here
357
- ctxInspect , cancelInspect := context .WithTimeout (context .Background (), c .config .Timeout .CreateContainer )
358
- defer cancelInspect ()
359
- info , err := node .Engine .ContainerInspect (ctxInspect , container .ID )
343
+ info , err := node .Engine .ContainerInspect (context .Background (), container .ID )
360
344
if err != nil {
361
345
log .Errorf ("[CreateContainerWithCPUPrior] Error when inspecting container, %v" , err )
362
346
ms [i ].Error = err .Error ()
@@ -366,7 +350,7 @@ func (c *calcium) doCreateContainerWithCPUPrior(nodeName string, cpuMap []types.
366
350
ms [i ].ContainerID = info .ID
367
351
368
352
// after start
369
- if err := runExec (node .Engine , info , AFTER_START , c . config . Timeout . CreateContainer ); err != nil {
353
+ if err := runExec (node .Engine , info , AFTER_START ); err != nil {
370
354
log .Errorf ("[CreateContainerWithCPUPrior] Run exec at %s error: %v" , AFTER_START , err )
371
355
}
372
356
0 commit comments