github.com/sijibomii/docker@v0.0.0-20231230191044-5cf6ca554647/daemon/update_linux.go (about)

     1  // +build linux
     2  
     3  package daemon
     4  
     5  import (
     6  	"github.com/docker/docker/libcontainerd"
     7  	"github.com/docker/engine-api/types/container"
     8  )
     9  
    10  func toContainerdResources(resources container.Resources) libcontainerd.Resources {
    11  	var r libcontainerd.Resources
    12  	r.BlkioWeight = uint32(resources.BlkioWeight)
    13  	r.CpuShares = uint32(resources.CPUShares)
    14  	r.CpuPeriod = uint32(resources.CPUPeriod)
    15  	r.CpuQuota = uint32(resources.CPUQuota)
    16  	r.CpusetCpus = resources.CpusetCpus
    17  	r.CpusetMems = resources.CpusetMems
    18  	r.MemoryLimit = uint32(resources.Memory)
    19  	if resources.MemorySwap > 0 {
    20  		r.MemorySwap = uint32(resources.MemorySwap)
    21  	}
    22  	r.MemoryReservation = uint32(resources.MemoryReservation)
    23  	r.KernelMemoryLimit = uint32(resources.KernelMemory)
    24  	return r
    25  }