From d8af59822b411ea8366b121324ce494910f67f26 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Thu, 2 Jul 2015 09:39:22 -0700 Subject: [PATCH] Remove spec types from runc Signed-off-by: Michael Crosby --- spec.go | 34 ------------------- spec_linux.go | 93 --------------------------------------------------- 2 files changed, 127 deletions(-) diff --git a/spec.go b/spec.go index 47cf3467..fb0bdb47 100644 --- a/spec.go +++ b/spec.go @@ -9,40 +9,6 @@ import ( "github.com/codegangsta/cli" ) -type Mount struct { - Type string `json:"type"` - Source string `json:"source"` - Destination string `json:"destination"` - Options string `json:"options"` -} - -type Process struct { - Terminal bool `json:"terminal"` - User User `json:"user"` - Args []string `json:"args"` - Env []string `json:"env"` - Cwd string `json:"cwd"` -} - -type Root struct { - Path string `json:"path"` - Readonly bool `json:"readonly"` -} - -type Platform struct { - OS string `json:"os"` - Arch string `json:"arch"` -} - -type PortableSpec struct { - Version string `json:"version"` - Platform Platform `json:"platform"` - Process Process `json:"process"` - Root Root `json:"root"` - Hostname string `json:"hostname"` - Mounts []Mount `json:"mounts"` -} - var specCommand = cli.Command{ Name: "spec", Usage: "create a new specification file", diff --git a/spec_linux.go b/spec_linux.go index d49dbdca..ca467e79 100644 --- a/spec_linux.go +++ b/spec_linux.go @@ -15,99 +15,6 @@ import ( "github.com/opencontainers/runc/libcontainer/devices" ) -type Spec struct { - PortableSpec - Linux Linux `json:"linux"` -} - -type Linux struct { - UserMapping map[string]UserMapping `json:"userMapping"` - Rlimits []Rlimit `json:"rlimits"` - SystemProperties map[string]string `json:"systemProperties"` - Resources *Resources `json:"resources"` - Namespaces []Namespace `json:"namespaces"` - Capabilities []string `json:"capabilities"` - Devices []string `json:"devices"` -} - -type User struct { - Uid int32 `json:"uid"` - Gid int32 `json:"gid"` - AdditionalGids []int32 `json:"additionalGids"` -} - -type Namespace struct { - Type string `json:"type"` - Path string `json:"path"` -} - -type UserMapping struct { - From int `json:"from"` - To int `json:"to"` - Count int `json:"count"` -} - -type Rlimit struct { - Type int `json:"type"` - Hard uint64 `json:"hard"` - Soft uint64 `json:"soft"` -} - -type HugepageLimit struct { - Pagesize string `json:"pageSize"` - Limit int `json:"limit"` -} - -type IfPrioMap struct { - Interface string `json:"interface"` - Priority int64 `json:"priority"` -} - -type Resources struct { - // Memory limit (in bytes) - MemoryLimit int64 `json:"memoryLimit"` - // Memory reservation or soft_limit (in bytes) - MemoryReservation int64 `json:"memoryReservation"` - // Total memory usage (memory + swap); set `-1' to disable swap - MemorySwap int64 `json:"memorySwap"` - // Kernel memory limit (in bytes) - KernelMemory int64 `json:"kernelMemory"` - // CPU shares (relative weight vs. other containers) - CpuShares int64 `json:"cpuShares"` - // CPU hardcap limit (in usecs). Allowed cpu time in a given period. - CpuQuota int64 `json:"cpuQuota"` - // CPU period to be used for hardcapping (in usecs). 0 to use system default. - CpuPeriod int64 `json:"cpuPeriod"` - // How many time CPU will use in realtime scheduling (in usecs). - CpuRtRuntime int64 `json:"cpuQuota"` - // CPU period to be used for realtime scheduling (in usecs). - CpuRtPeriod int64 `json:"cpuPeriod"` - // CPU to use - CpusetCpus string `json:"cpusetCpus"` - // MEM to use - CpusetMems string `json:"cpusetMems"` - // IO read rate limit per cgroup per device, bytes per second. - BlkioThrottleReadBpsDevice string `json:"blkioThrottleReadBpsDevice"` - // IO write rate limit per cgroup per divice, bytes per second. - BlkioThrottleWriteBpsDevice string `json:"blkioThrottleWriteBpsDevice"` - // IO read rate limit per cgroup per device, IO per second. - BlkioThrottleReadIOpsDevice string `json:"blkioThrottleReadIopsDevice"` - // IO write rate limit per cgroup per device, IO per second. - BlkioThrottleWriteIOpsDevice string `json:"blkioThrottleWriteIopsDevice"` - // Specifies per cgroup weight, range is from 10 to 1000. - BlkioWeight int64 `json:"blkioWeight"` - // Weight per cgroup per device, can override BlkioWeight. - BlkioWeightDevice string `json:"blkioWeightDevice"` - // Hugetlb limit (in bytes) - HugetlbLimit []*HugepageLimit `json:"hugetlbLimit"` - // Whether to disable OOM Killer - DisableOOMKiller bool `json:"disableOOMKiller"` - // Set priority of network traffic for container - NetPrioIfpriomap []*IfPrioMap `json:"netPrioIfpriomap"` - // Set class identifier for container's network packets - NetClsClassid string `json:"netClsClassid"` -} - var namespaceMapping = map[string]configs.NamespaceType{ "process": configs.NEWPID, "network": configs.NEWNET,