due to docker issue, realloc unbind cpu will bind all cpu to targets (fixed
@@ -342,17 +342,19 @@ func (e *Engine) VirtualizationUpdateResource(ctx context.Context, ID string, op
cpuMap := opts.CPU
numaNode := opts.NUMANode
// unlimited cpu
- if quota == 0 {
- info, err := e.Info(ctx)
+ if quota == 0 || len(cpuMap) == 0 {
+ info, err := e.Info(ctx) // TODO can fixed in docker engine, support empty Cpusetcpus, or use cache to speed up
if err != nil {
return err
}
- quota = -1
- numaNode = ""
cpuMap = map[string]int64{}
for i := 0; i < info.NCPU; i++ {
cpuMap[strconv.Itoa(i)] = int64(e.config.Scheduler.ShareBase)
}
+ if quota == 0 {
+ quota = -1
+ numaNode = ""
+ }
}
newResource := makeResourceSetting(quota, memory, cpuMap, numaNode, softLimit)
