moby/daemon/update_linux.go
Michael Crosby 91e197d614 Add engine-api types to docker
This moves the types for the `engine-api` repo to the existing types
package.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-09-07 11:05:58 -07:00

25 lines
745 B
Go

// +build linux
package daemon
import (
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/libcontainerd"
)
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
}