Skip to content

Commit

Permalink
Remove package pkg/ulimit, use go-units instead.
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Nephin <[email protected]>
  • Loading branch information
dnephin committed Dec 23, 2015
1 parent 5adbea7 commit 83237aa
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 192 deletions.
4 changes: 2 additions & 2 deletions api/server/router/build/build_routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import (
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/progress"
"github.com/docker/docker/pkg/streamformatter"
"github.com/docker/docker/pkg/ulimit"
"github.com/docker/docker/reference"
"github.com/docker/docker/utils"
"github.com/docker/go-units"
"golang.org/x/net/context"
)

Expand Down Expand Up @@ -151,7 +151,7 @@ func (br *buildRouter) postBuild(ctx context.Context, w http.ResponseWriter, r *
buildConfig.Isolation = i
}

var buildUlimits = []*ulimit.Ulimit{}
var buildUlimits = []*units.Ulimit{}
ulimitsJSON := r.FormValue("ulimits")
if ulimitsJSON != "" {
if err := json.NewDecoder(strings.NewReader(ulimitsJSON)).Decode(&buildUlimits); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions api/types/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/pkg/ulimit"
"github.com/docker/go-units"
)

// ContainerAttachOptions holds parameters to attach to a container.
Expand Down Expand Up @@ -137,7 +137,7 @@ type ImageBuildOptions struct {
CgroupParent string
ShmSize string
Dockerfile string
Ulimits []*ulimit.Ulimit
Ulimits []*units.Ulimit
BuildArgs []string
AuthConfigs map[string]AuthConfig
Context io.Reader
Expand Down
26 changes: 13 additions & 13 deletions api/types/container/host_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (

"github.com/docker/docker/api/types/blkiodev"
"github.com/docker/docker/api/types/strslice"
"github.com/docker/docker/pkg/ulimit"
"github.com/docker/go-connections/nat"
"github.com/docker/go-units"
)

// NetworkMode represents the container network stack.
Expand Down Expand Up @@ -170,18 +170,18 @@ type Resources struct {
BlkioDeviceWriteBps []*blkiodev.ThrottleDevice
BlkioDeviceReadIOps []*blkiodev.ThrottleDevice
BlkioDeviceWriteIOps []*blkiodev.ThrottleDevice
CPUPeriod int64 `json:"CpuPeriod"` // CPU CFS (Completely Fair Scheduler) period
CPUQuota int64 `json:"CpuQuota"` // CPU CFS (Completely Fair Scheduler) quota
CpusetCpus string // CpusetCpus 0-2, 0,1
CpusetMems string // CpusetMems 0-2, 0,1
Devices []DeviceMapping // List of devices to map inside the container
KernelMemory int64 // Kernel memory limit (in bytes)
Memory int64 // Memory limit (in bytes)
MemoryReservation int64 // Memory soft limit (in bytes)
MemorySwap int64 // Total memory usage (memory + swap); set `-1` to disable swap
MemorySwappiness *int64 // Tuning container memory swappiness behaviour
OomKillDisable bool // Whether to disable OOM Killer or not
Ulimits []*ulimit.Ulimit // List of ulimits to be set in the container
CPUPeriod int64 `json:"CpuPeriod"` // CPU CFS (Completely Fair Scheduler) period
CPUQuota int64 `json:"CpuQuota"` // CPU CFS (Completely Fair Scheduler) quota
CpusetCpus string // CpusetCpus 0-2, 0,1
CpusetMems string // CpusetMems 0-2, 0,1
Devices []DeviceMapping // List of devices to map inside the container
KernelMemory int64 // Kernel memory limit (in bytes)
Memory int64 // Memory limit (in bytes)
MemoryReservation int64 // Memory soft limit (in bytes)
MemorySwap int64 // Total memory usage (memory + swap); set `-1` to disable swap
MemorySwappiness *int64 // Tuning container memory swappiness behaviour
OomKillDisable bool // Whether to disable OOM Killer or not
Ulimits []*units.Ulimit // List of ulimits to be set in the container
}

// HostConfig the non-portable Config structure of a container.
Expand Down
4 changes: 2 additions & 2 deletions builder/dockerfile/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/docker/docker/builder"
"github.com/docker/docker/builder/dockerfile/parser"
"github.com/docker/docker/pkg/stringid"
"github.com/docker/docker/pkg/ulimit"
"github.com/docker/go-units"
)

var validCommitCommands = map[string]bool{
Expand Down Expand Up @@ -66,7 +66,7 @@ type Config struct {
CPUSetCpus string
CPUSetMems string
CgroupParent string
Ulimits []*ulimit.Ulimit
Ulimits []*units.Ulimit
}

// Builder is a Dockerfile builder
Expand Down
6 changes: 3 additions & 3 deletions daemon/container_operations_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"github.com/docker/docker/pkg/idtools"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/stringid"
"github.com/docker/docker/pkg/ulimit"
"github.com/docker/docker/runconfig"
"github.com/docker/go-units"
"github.com/docker/libnetwork"
"github.com/docker/libnetwork/netlabel"
"github.com/docker/libnetwork/options"
Expand Down Expand Up @@ -146,11 +146,11 @@ func (daemon *Daemon) populateCommand(c *container.Container, env []string) erro

autoCreatedDevices := mergeDevices(configs.DefaultAutoCreatedDevices, userSpecifiedDevices)

var rlimits []*ulimit.Rlimit
var rlimits []*units.Rlimit
ulimits := c.HostConfig.Ulimits

// Merge ulimits with daemon defaults
ulIdx := make(map[string]*ulimit.Ulimit)
ulIdx := make(map[string]*units.Ulimit)
for _, ul := range ulimits {
ulIdx[ul.Name] = ul
}
Expand Down
4 changes: 2 additions & 2 deletions daemon/execdriver/driver_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/docker/docker/daemon/execdriver/native/template"
"github.com/docker/docker/pkg/idtools"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/ulimit"
"github.com/docker/go-units"
"github.com/opencontainers/runc/libcontainer"
"github.com/opencontainers/runc/libcontainer/cgroups/fs"
"github.com/opencontainers/runc/libcontainer/configs"
Expand Down Expand Up @@ -48,7 +48,7 @@ type Resources struct {
CpusetCpus string `json:"cpuset_cpus"`
CpusetMems string `json:"cpuset_mems"`
CPUPeriod int64 `json:"cpu_period"`
Rlimits []*ulimit.Rlimit `json:"rlimits"`
Rlimits []*units.Rlimit `json:"rlimits"`
OomKillDisable bool `json:"oom_kill_disable"`
MemorySwappiness int64 `json:"memory_swappiness"`
}
Expand Down
4 changes: 2 additions & 2 deletions integration-cli/docker_cli_build_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"

"github.com/docker/docker/pkg/integration/checker"
"github.com/docker/docker/pkg/ulimit"
"github.com/docker/go-units"
"github.com/go-check/check"
)

Expand All @@ -33,7 +33,7 @@ func (s *DockerSuite) TestBuildResourceConstraintsAreUsed(c *check.C) {
CpusetMems string
CPUShares int64
CPUQuota int64
Ulimits []*ulimit.Ulimit
Ulimits []*units.Ulimit
}

cfg, err := inspectFieldJSON(cID, "HostConfig")
Expand Down
111 changes: 0 additions & 111 deletions pkg/ulimit/ulimit.go

This file was deleted.

55 changes: 0 additions & 55 deletions pkg/ulimit/ulimit_test.go

This file was deleted.

0 comments on commit 83237aa

Please sign in to comment.