Skip to content

Commit f52a97d

Browse files
committed
due to docker issue, realloc unbind cpu will bind all cpu to targets (fixed #228)
1 parent 92447db commit f52a97d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

engine/docker/container.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -342,17 +342,19 @@ func (e *Engine) VirtualizationUpdateResource(ctx context.Context, ID string, op
342342
cpuMap := opts.CPU
343343
numaNode := opts.NUMANode
344344
// unlimited cpu
345-
if quota == 0 {
346-
info, err := e.Info(ctx)
345+
if quota == 0 || len(cpuMap) == 0 {
346+
info, err := e.Info(ctx) // TODO can fixed in docker engine, support empty Cpusetcpus, or use cache to speed up
347347
if err != nil {
348348
return err
349349
}
350-
quota = -1
351-
numaNode = ""
352350
cpuMap = map[string]int64{}
353351
for i := 0; i < info.NCPU; i++ {
354352
cpuMap[strconv.Itoa(i)] = int64(e.config.Scheduler.ShareBase)
355353
}
354+
if quota == 0 {
355+
quota = -1
356+
numaNode = ""
357+
}
356358
}
357359

358360
newResource := makeResourceSetting(quota, memory, cpuMap, numaNode, softLimit)

0 commit comments

Comments
 (0)