mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
2e9ea5c194
containerd: 860f3a94940894ac0a106eff4bd1616a67407ee2 runc: 85873d917e86676e44ccb80719fcb47a794676a1 runtime-specs: v1.0.0-rc1 Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
25 lines
745 B
Go
25 lines
745 B
Go
// +build linux
|
|
|
|
package daemon
|
|
|
|
import (
|
|
"github.com/docker/docker/libcontainerd"
|
|
"github.com/docker/engine-api/types/container"
|
|
)
|
|
|
|
func toContainerdResources(resources container.Resources) libcontainerd.Resources {
|
|
var r libcontainerd.Resources
|
|
r.BlkioWeight = uint64(resources.BlkioWeight)
|
|
r.CpuShares = uint64(resources.CPUShares)
|
|
r.CpuPeriod = uint64(resources.CPUPeriod)
|
|
r.CpuQuota = uint64(resources.CPUQuota)
|
|
r.CpusetCpus = resources.CpusetCpus
|
|
r.CpusetMems = resources.CpusetMems
|
|
r.MemoryLimit = uint64(resources.Memory)
|
|
if resources.MemorySwap > 0 {
|
|
r.MemorySwap = uint64(resources.MemorySwap)
|
|
}
|
|
r.MemoryReservation = uint64(resources.MemoryReservation)
|
|
r.KernelMemoryLimit = uint64(resources.KernelMemory)
|
|
return r
|
|
}
|