fix golint warnings/errors on package api/types/
| ... | ... |
@@ -61,8 +61,8 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
|
| 61 | 61 |
fmt.Fprintf(cli.out, "Docker Root Dir: %s\n", info.DockerRootDir) |
| 62 | 62 |
} |
| 63 | 63 |
|
| 64 |
- ioutils.FprintfIfNotEmpty(cli.out, "Http Proxy: %s\n", info.HttpProxy) |
|
| 65 |
- ioutils.FprintfIfNotEmpty(cli.out, "Https Proxy: %s\n", info.HttpsProxy) |
|
| 64 |
+ ioutils.FprintfIfNotEmpty(cli.out, "Http Proxy: %s\n", info.HTTPProxy) |
|
| 65 |
+ ioutils.FprintfIfNotEmpty(cli.out, "Https Proxy: %s\n", info.HTTPSProxy) |
|
| 66 | 66 |
ioutils.FprintfIfNotEmpty(cli.out, "No Proxy: %s\n", info.NoProxy) |
| 67 | 67 |
|
| 68 | 68 |
if info.IndexServerAddress != "" {
|
| ... | ... |
@@ -87,7 +87,7 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
|
| 87 | 87 |
if !info.BridgeNfIptables {
|
| 88 | 88 |
fmt.Fprintf(cli.err, "WARNING: bridge-nf-call-iptables is disabled\n") |
| 89 | 89 |
} |
| 90 |
- if !info.BridgeNfIp6tables {
|
|
| 90 |
+ if !info.BridgeNfIP6tables {
|
|
| 91 | 91 |
fmt.Fprintf(cli.err, "WARNING: bridge-nf-call-ip6tables is disabled\n") |
| 92 | 92 |
} |
| 93 | 93 |
} |
| ... | ... |
@@ -65,8 +65,8 @@ func (s *containerStats) Collect(cli *DockerCli, streamStats bool) {
|
| 65 | 65 |
memPercent = float64(v.MemoryStats.Usage) / float64(v.MemoryStats.Limit) * 100.0 |
| 66 | 66 |
cpuPercent = 0.0 |
| 67 | 67 |
) |
| 68 |
- previousCPU = v.PreCpuStats.CpuUsage.TotalUsage |
|
| 69 |
- previousSystem = v.PreCpuStats.SystemUsage |
|
| 68 |
+ previousCPU = v.PreCPUStats.CPUUsage.TotalUsage |
|
| 69 |
+ previousSystem = v.PreCPUStats.SystemUsage |
|
| 70 | 70 |
cpuPercent = calculateCPUPercent(previousCPU, previousSystem, v) |
| 71 | 71 |
blkRead, blkWrite := calculateBlockIO(v.BlkioStats) |
| 72 | 72 |
s.mu.Lock() |
| ... | ... |
@@ -196,13 +196,13 @@ func calculateCPUPercent(previousCPU, previousSystem uint64, v *types.Stats) flo |
| 196 | 196 |
var ( |
| 197 | 197 |
cpuPercent = 0.0 |
| 198 | 198 |
// calculate the change for the cpu usage of the container in between readings |
| 199 |
- cpuDelta = float64(v.CpuStats.CpuUsage.TotalUsage - previousCPU) |
|
| 199 |
+ cpuDelta = float64(v.CPUStats.CPUUsage.TotalUsage - previousCPU) |
|
| 200 | 200 |
// calculate the change for the entire system between readings |
| 201 |
- systemDelta = float64(v.CpuStats.SystemUsage - previousSystem) |
|
| 201 |
+ systemDelta = float64(v.CPUStats.SystemUsage - previousSystem) |
|
| 202 | 202 |
) |
| 203 | 203 |
|
| 204 | 204 |
if systemDelta > 0.0 && cpuDelta > 0.0 {
|
| 205 |
- cpuPercent = (cpuDelta / systemDelta) * float64(len(v.CpuStats.CpuUsage.PercpuUsage)) * 100.0 |
|
| 205 |
+ cpuPercent = (cpuDelta / systemDelta) * float64(len(v.CPUStats.CPUUsage.PercpuUsage)) * 100.0 |
|
| 206 | 206 |
} |
| 207 | 207 |
return cpuPercent |
| 208 | 208 |
} |
| ... | ... |
@@ -15,7 +15,7 @@ import ( |
| 15 | 15 |
|
| 16 | 16 |
var versionTemplate = `Client: |
| 17 | 17 |
Version: {{.Client.Version}}
|
| 18 |
- API version: {{.Client.ApiVersion}}
|
|
| 18 |
+ API version: {{.Client.APIVersion}}
|
|
| 19 | 19 |
Go version: {{.Client.GoVersion}}
|
| 20 | 20 |
Git commit: {{.Client.GitCommit}}
|
| 21 | 21 |
Built: {{.Client.BuildTime}}
|
| ... | ... |
@@ -24,7 +24,7 @@ var versionTemplate = `Client: |
| 24 | 24 |
|
| 25 | 25 |
Server: |
| 26 | 26 |
Version: {{.Server.Version}}
|
| 27 |
- API version: {{.Server.ApiVersion}}
|
|
| 27 |
+ API version: {{.Server.APIVersion}}
|
|
| 28 | 28 |
Go version: {{.Server.GoVersion}}
|
| 29 | 29 |
Git commit: {{.Server.GitCommit}}
|
| 30 | 30 |
Built: {{.Server.BuildTime}}
|
| ... | ... |
@@ -61,7 +61,7 @@ func (cli *DockerCli) CmdVersion(args ...string) (err error) {
|
| 61 | 61 |
vd := versionData{
|
| 62 | 62 |
Client: types.Version{
|
| 63 | 63 |
Version: dockerversion.VERSION, |
| 64 |
- ApiVersion: api.Version, |
|
| 64 |
+ APIVersion: api.Version, |
|
| 65 | 65 |
GoVersion: runtime.Version(), |
| 66 | 66 |
GitCommit: dockerversion.GITCOMMIT, |
| 67 | 67 |
BuildTime: dockerversion.BUILDTIME, |
| ... | ... |
@@ -23,7 +23,7 @@ import ( |
| 23 | 23 |
func (s *Server) getVersion(version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
| 24 | 24 |
v := &types.Version{
|
| 25 | 25 |
Version: dockerversion.VERSION, |
| 26 |
- ApiVersion: api.Version, |
|
| 26 |
+ APIVersion: api.Version, |
|
| 27 | 27 |
GitCommit: dockerversion.GITCOMMIT, |
| 28 | 28 |
GoVersion: runtime.Version(), |
| 29 | 29 |
Os: runtime.GOOS, |
| ... | ... |
@@ -1,9 +1,10 @@ |
| 1 |
-// This package is used for API stability in the types and response to the |
|
| 1 |
+// Package types is used for API stability in the types and response to the |
|
| 2 | 2 |
// consumers of the API stats endpoint. |
| 3 | 3 |
package types |
| 4 | 4 |
|
| 5 | 5 |
import "time" |
| 6 | 6 |
|
| 7 |
+// ThrottlingData stores CPU throttling stats of one running container |
|
| 7 | 8 |
type ThrottlingData struct {
|
| 8 | 9 |
// Number of periods with throttling active |
| 9 | 10 |
Periods uint64 `json:"periods"` |
| ... | ... |
@@ -13,8 +14,8 @@ type ThrottlingData struct {
|
| 13 | 13 |
ThrottledTime uint64 `json:"throttled_time"` |
| 14 | 14 |
} |
| 15 | 15 |
|
| 16 |
-// All CPU stats are aggregated since container inception. |
|
| 17 |
-type CpuUsage struct {
|
|
| 16 |
+// CPUUsage stores All CPU stats aggregated since container inception. |
|
| 17 |
+type CPUUsage struct {
|
|
| 18 | 18 |
// Total CPU time consumed. |
| 19 | 19 |
// Units: nanoseconds. |
| 20 | 20 |
TotalUsage uint64 `json:"total_usage"` |
| ... | ... |
@@ -29,12 +30,14 @@ type CpuUsage struct {
|
| 29 | 29 |
UsageInUsermode uint64 `json:"usage_in_usermode"` |
| 30 | 30 |
} |
| 31 | 31 |
|
| 32 |
-type CpuStats struct {
|
|
| 33 |
- CpuUsage CpuUsage `json:"cpu_usage"` |
|
| 32 |
+// CPUStats aggregates and wraps all CPU related info of container |
|
| 33 |
+type CPUStats struct {
|
|
| 34 |
+ CPUUsage CPUUsage `json:"cpu_usage"` |
|
| 34 | 35 |
SystemUsage uint64 `json:"system_cpu_usage"` |
| 35 | 36 |
ThrottlingData ThrottlingData `json:"throttling_data,omitempty"` |
| 36 | 37 |
} |
| 37 | 38 |
|
| 39 |
+// MemoryStats aggregates All memory stats since container inception |
|
| 38 | 40 |
type MemoryStats struct {
|
| 39 | 41 |
// current res_counter usage for memory |
| 40 | 42 |
Usage uint64 `json:"usage"` |
| ... | ... |
@@ -48,6 +51,7 @@ type MemoryStats struct {
|
| 48 | 48 |
Limit uint64 `json:"limit"` |
| 49 | 49 |
} |
| 50 | 50 |
|
| 51 |
+// BlkioStatEntry is one small entity to store a piece of Blkio stats |
|
| 51 | 52 |
// TODO Windows: This can be factored out |
| 52 | 53 |
type BlkioStatEntry struct {
|
| 53 | 54 |
Major uint64 `json:"major"` |
| ... | ... |
@@ -56,6 +60,7 @@ type BlkioStatEntry struct {
|
| 56 | 56 |
Value uint64 `json:"value"` |
| 57 | 57 |
} |
| 58 | 58 |
|
| 59 |
+// BlkioStats stores All IO service stats for data read and write |
|
| 59 | 60 |
// TODO Windows: This can be factored out |
| 60 | 61 |
type BlkioStats struct {
|
| 61 | 62 |
// number of bytes tranferred to and from the block device |
| ... | ... |
@@ -69,8 +74,9 @@ type BlkioStats struct {
|
| 69 | 69 |
SectorsRecursive []BlkioStatEntry `json:"sectors_recursive"` |
| 70 | 70 |
} |
| 71 | 71 |
|
| 72 |
+// NetworkStats aggregates All network stats of one container |
|
| 72 | 73 |
// TODO Windows: This will require refactoring |
| 73 |
-type Network struct {
|
|
| 74 |
+type NetworkStats struct {
|
|
| 74 | 75 |
RxBytes uint64 `json:"rx_bytes"` |
| 75 | 76 |
RxPackets uint64 `json:"rx_packets"` |
| 76 | 77 |
RxErrors uint64 `json:"rx_errors"` |
| ... | ... |
@@ -81,11 +87,12 @@ type Network struct {
|
| 81 | 81 |
TxDropped uint64 `json:"tx_dropped"` |
| 82 | 82 |
} |
| 83 | 83 |
|
| 84 |
+// Stats is Ultimate struct aggregating all types of stats of one container |
|
| 84 | 85 |
type Stats struct {
|
| 85 |
- Read time.Time `json:"read"` |
|
| 86 |
- Network Network `json:"network,omitempty"` |
|
| 87 |
- PreCpuStats CpuStats `json:"precpu_stats,omitempty"` |
|
| 88 |
- CpuStats CpuStats `json:"cpu_stats,omitempty"` |
|
| 89 |
- MemoryStats MemoryStats `json:"memory_stats,omitempty"` |
|
| 90 |
- BlkioStats BlkioStats `json:"blkio_stats,omitempty"` |
|
| 86 |
+ Read time.Time `json:"read"` |
|
| 87 |
+ Network NetworkStats `json:"network,omitempty"` |
|
| 88 |
+ PreCPUStats CPUStats `json:"precpu_stats,omitempty"` |
|
| 89 |
+ CPUStats CPUStats `json:"cpu_stats,omitempty"` |
|
| 90 |
+ MemoryStats MemoryStats `json:"memory_stats,omitempty"` |
|
| 91 |
+ BlkioStats BlkioStats `json:"blkio_stats,omitempty"` |
|
| 91 | 92 |
} |
| ... | ... |
@@ -19,35 +19,41 @@ type ContainerCreateResponse struct {
|
| 19 | 19 |
Warnings []string `json:"Warnings"` |
| 20 | 20 |
} |
| 21 | 21 |
|
| 22 |
-// POST /containers/{name:.*}/exec
|
|
| 22 |
+// ContainerExecCreateResponse contains response of Remote API: |
|
| 23 |
+// POST "/containers/{name:.*}/exec"
|
|
| 23 | 24 |
type ContainerExecCreateResponse struct {
|
| 24 | 25 |
// ID is the exec ID. |
| 25 | 26 |
ID string `json:"Id"` |
| 26 | 27 |
} |
| 27 | 28 |
|
| 28 |
-// POST /auth |
|
| 29 |
+// AuthResponse contains response of Remote API: |
|
| 30 |
+// POST "/auth" |
|
| 29 | 31 |
type AuthResponse struct {
|
| 30 | 32 |
// Status is the authentication status |
| 31 | 33 |
Status string `json:"Status"` |
| 32 | 34 |
} |
| 33 | 35 |
|
| 36 |
+// ContainerWaitResponse contains response of Remote API: |
|
| 34 | 37 |
// POST "/containers/"+containerID+"/wait" |
| 35 | 38 |
type ContainerWaitResponse struct {
|
| 36 | 39 |
// StatusCode is the status code of the wait job |
| 37 | 40 |
StatusCode int `json:"StatusCode"` |
| 38 | 41 |
} |
| 39 | 42 |
|
| 43 |
+// ContainerCommitResponse contains response of Remote API: |
|
| 40 | 44 |
// POST "/commit?container="+containerID |
| 41 | 45 |
type ContainerCommitResponse struct {
|
| 42 | 46 |
ID string `json:"Id"` |
| 43 | 47 |
} |
| 44 | 48 |
|
| 49 |
+// ContainerChange contains response of Remote API: |
|
| 45 | 50 |
// GET "/containers/{name:.*}/changes"
|
| 46 | 51 |
type ContainerChange struct {
|
| 47 | 52 |
Kind int |
| 48 | 53 |
Path string |
| 49 | 54 |
} |
| 50 | 55 |
|
| 56 |
+// ImageHistory contains response of Remote API: |
|
| 51 | 57 |
// GET "/images/{name:.*}/history"
|
| 52 | 58 |
type ImageHistory struct {
|
| 53 | 59 |
ID string `json:"Id"` |
| ... | ... |
@@ -58,16 +64,18 @@ type ImageHistory struct {
|
| 58 | 58 |
Comment string |
| 59 | 59 |
} |
| 60 | 60 |
|
| 61 |
+// ImageDelete contains response of Remote API: |
|
| 61 | 62 |
// DELETE "/images/{name:.*}"
|
| 62 | 63 |
type ImageDelete struct {
|
| 63 | 64 |
Untagged string `json:",omitempty"` |
| 64 | 65 |
Deleted string `json:",omitempty"` |
| 65 | 66 |
} |
| 66 | 67 |
|
| 68 |
+// Image contains response of Remote API: |
|
| 67 | 69 |
// GET "/images/json" |
| 68 | 70 |
type Image struct {
|
| 69 | 71 |
ID string `json:"Id"` |
| 70 |
- ParentId string |
|
| 72 |
+ ParentID string `json:"ParentId"` |
|
| 71 | 73 |
RepoTags []string |
| 72 | 74 |
RepoDigests []string |
| 73 | 75 |
Created int64 |
| ... | ... |
@@ -76,14 +84,17 @@ type Image struct {
|
| 76 | 76 |
Labels map[string]string |
| 77 | 77 |
} |
| 78 | 78 |
|
| 79 |
+// GraphDriverData returns Image's graph driver config info |
|
| 80 |
+// when calling inspect command |
|
| 79 | 81 |
type GraphDriverData struct {
|
| 80 | 82 |
Name string |
| 81 | 83 |
Data map[string]string |
| 82 | 84 |
} |
| 83 | 85 |
|
| 86 |
+// ImageInspect contains response of Remote API: |
|
| 84 | 87 |
// GET "/images/{name:.*}/json"
|
| 85 | 88 |
type ImageInspect struct {
|
| 86 |
- Id string |
|
| 89 |
+ ID string `json:"Id"` |
|
| 87 | 90 |
Parent string |
| 88 | 91 |
Comment string |
| 89 | 92 |
Created string |
| ... | ... |
@@ -99,7 +110,8 @@ type ImageInspect struct {
|
| 99 | 99 |
GraphDriver GraphDriverData |
| 100 | 100 |
} |
| 101 | 101 |
|
| 102 |
-// GET "/containers/json" |
|
| 102 |
+// Port stores open ports info of container |
|
| 103 |
+// e.g. {"PrivatePort": 8080, "PublicPort": 80, "Type": "tcp"}
|
|
| 103 | 104 |
type Port struct {
|
| 104 | 105 |
IP string `json:",omitempty"` |
| 105 | 106 |
PrivatePort int |
| ... | ... |
@@ -107,6 +119,8 @@ type Port struct {
|
| 107 | 107 |
Type string |
| 108 | 108 |
} |
| 109 | 109 |
|
| 110 |
+// Container contains response of Remote API: |
|
| 111 |
+// GET "/containers/json" |
|
| 110 | 112 |
type Container struct {
|
| 111 | 113 |
ID string `json:"Id"` |
| 112 | 114 |
Names []string |
| ... | ... |
@@ -123,14 +137,15 @@ type Container struct {
|
| 123 | 123 |
} |
| 124 | 124 |
} |
| 125 | 125 |
|
| 126 |
+// CopyConfig contains request body of Remote API: |
|
| 126 | 127 |
// POST "/containers/"+containerID+"/copy" |
| 127 | 128 |
type CopyConfig struct {
|
| 128 | 129 |
Resource string |
| 129 | 130 |
} |
| 130 | 131 |
|
| 131 | 132 |
// ContainerPathStat is used to encode the header from |
| 132 |
-// GET /containers/{name:.*}/archive
|
|
| 133 |
-// "name" is basename of the resource. |
|
| 133 |
+// GET "/containers/{name:.*}/archive"
|
|
| 134 |
+// "Name" is the file or directory name. |
|
| 134 | 135 |
type ContainerPathStat struct {
|
| 135 | 136 |
Name string `json:"name"` |
| 136 | 137 |
Size int64 `json:"size"` |
| ... | ... |
@@ -139,15 +154,18 @@ type ContainerPathStat struct {
|
| 139 | 139 |
LinkTarget string `json:"linkTarget"` |
| 140 | 140 |
} |
| 141 | 141 |
|
| 142 |
+// ContainerProcessList contains response of Remote API: |
|
| 142 | 143 |
// GET "/containers/{name:.*}/top"
|
| 143 | 144 |
type ContainerProcessList struct {
|
| 144 | 145 |
Processes [][]string |
| 145 | 146 |
Titles []string |
| 146 | 147 |
} |
| 147 | 148 |
|
| 149 |
+// Version contains response of Remote API: |
|
| 150 |
+// GET "/version" |
|
| 148 | 151 |
type Version struct {
|
| 149 | 152 |
Version string |
| 150 |
- ApiVersion version.Version |
|
| 153 |
+ APIVersion version.Version `json:"ApiVersion"` |
|
| 151 | 154 |
GitCommit string |
| 152 | 155 |
GoVersion string |
| 153 | 156 |
Os string |
| ... | ... |
@@ -157,6 +175,7 @@ type Version struct {
|
| 157 | 157 |
BuildTime string `json:",omitempty"` |
| 158 | 158 |
} |
| 159 | 159 |
|
| 160 |
+// Info contains response of Remote API: |
|
| 160 | 161 |
// GET "/info" |
| 161 | 162 |
type Info struct {
|
| 162 | 163 |
ID string |
| ... | ... |
@@ -166,11 +185,11 @@ type Info struct {
|
| 166 | 166 |
DriverStatus [][2]string |
| 167 | 167 |
MemoryLimit bool |
| 168 | 168 |
SwapLimit bool |
| 169 |
- CpuCfsPeriod bool |
|
| 170 |
- CpuCfsQuota bool |
|
| 169 |
+ CPUCfsPeriod bool `json:"CpuCfsPeriod"` |
|
| 170 |
+ CPUCfsQuota bool `json:"CpuCfsQuota"` |
|
| 171 | 171 |
IPv4Forwarding bool |
| 172 | 172 |
BridgeNfIptables bool |
| 173 |
- BridgeNfIp6tables bool |
|
| 173 |
+ BridgeNfIP6tables bool `json:"BridgeNfIp6tables"` |
|
| 174 | 174 |
Debug bool |
| 175 | 175 |
NFd int |
| 176 | 176 |
OomKillDisable bool |
| ... | ... |
@@ -188,15 +207,15 @@ type Info struct {
|
| 188 | 188 |
NCPU int |
| 189 | 189 |
MemTotal int64 |
| 190 | 190 |
DockerRootDir string |
| 191 |
- HttpProxy string |
|
| 192 |
- HttpsProxy string |
|
| 191 |
+ HTTPProxy string `json:"HttpProxy"` |
|
| 192 |
+ HTTPSProxy string `json:"HttpsProxy"` |
|
| 193 | 193 |
NoProxy string |
| 194 | 194 |
Name string |
| 195 | 195 |
Labels []string |
| 196 | 196 |
ExperimentalBuild bool |
| 197 | 197 |
} |
| 198 | 198 |
|
| 199 |
-// This struct is a temp struct used by execStart |
|
| 199 |
+// ExecStartCheck is a temp struct used by execStart |
|
| 200 | 200 |
// Config fields is part of ExecConfig in runconfig package |
| 201 | 201 |
type ExecStartCheck struct {
|
| 202 | 202 |
// ExecStart will first check if it's detached |
| ... | ... |
@@ -205,6 +224,8 @@ type ExecStartCheck struct {
|
| 205 | 205 |
Tty bool |
| 206 | 206 |
} |
| 207 | 207 |
|
| 208 |
+// ContainerState stores container's running state |
|
| 209 |
+// it's part of ContainerJSONBase and will return by "inspect" command |
|
| 208 | 210 |
type ContainerState struct {
|
| 209 | 211 |
Running bool |
| 210 | 212 |
Paused bool |
| ... | ... |
@@ -218,9 +239,10 @@ type ContainerState struct {
|
| 218 | 218 |
FinishedAt string |
| 219 | 219 |
} |
| 220 | 220 |
|
| 221 |
+// ContainerJSONBase contains response of Remote API: |
|
| 221 | 222 |
// GET "/containers/{name:.*}/json"
|
| 222 | 223 |
type ContainerJSONBase struct {
|
| 223 |
- Id string |
|
| 224 |
+ ID string `json:"Id"` |
|
| 224 | 225 |
Created string |
| 225 | 226 |
Path string |
| 226 | 227 |
Args []string |
| ... | ... |
@@ -243,14 +265,15 @@ type ContainerJSONBase struct {
|
| 243 | 243 |
GraphDriver GraphDriverData |
| 244 | 244 |
} |
| 245 | 245 |
|
| 246 |
+// ContainerJSON is newly used struct along with MountPoint |
|
| 246 | 247 |
type ContainerJSON struct {
|
| 247 | 248 |
*ContainerJSONBase |
| 248 | 249 |
Mounts []MountPoint |
| 249 | 250 |
Config *runconfig.Config |
| 250 | 251 |
} |
| 251 | 252 |
|
| 252 |
-// backcompatibility struct along with ContainerConfig. Note this is not |
|
| 253 |
-// used by the Windows daemon. |
|
| 253 |
+// ContainerJSONPre120 is a backcompatibility struct along with ContainerConfig. |
|
| 254 |
+// Note this is not used by the Windows daemon. |
|
| 254 | 255 |
type ContainerJSONPre120 struct {
|
| 255 | 256 |
*ContainerJSONBase |
| 256 | 257 |
Volumes map[string]string |
| ... | ... |
@@ -258,14 +281,15 @@ type ContainerJSONPre120 struct {
|
| 258 | 258 |
Config *ContainerConfig |
| 259 | 259 |
} |
| 260 | 260 |
|
| 261 |
+// ContainerConfig is a backcompatibility struct used in ContainerJSONPre120 |
|
| 261 | 262 |
type ContainerConfig struct {
|
| 262 | 263 |
*runconfig.Config |
| 263 | 264 |
|
| 264 | 265 |
// backward compatibility, they now live in HostConfig |
| 265 | 266 |
Memory int64 |
| 266 | 267 |
MemorySwap int64 |
| 267 |
- CpuShares int64 |
|
| 268 |
- Cpuset string |
|
| 268 |
+ CPUShares int64 `json:"CpuShares"` |
|
| 269 |
+ CPUSet string `json:"CpuSet"` |
|
| 269 | 270 |
} |
| 270 | 271 |
|
| 271 | 272 |
// MountPoint represents a mount point configuration inside the container. |
| ... | ... |
@@ -67,7 +67,7 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
|
| 67 | 67 |
DriverStatus: daemon.GraphDriver().Status(), |
| 68 | 68 |
IPv4Forwarding: !sysInfo.IPv4ForwardingDisabled, |
| 69 | 69 |
BridgeNfIptables: !sysInfo.BridgeNfCallIptablesDisabled, |
| 70 |
- BridgeNfIp6tables: !sysInfo.BridgeNfCallIP6tablesDisabled, |
|
| 70 |
+ BridgeNfIP6tables: !sysInfo.BridgeNfCallIP6tablesDisabled, |
|
| 71 | 71 |
Debug: os.Getenv("DEBUG") != "",
|
| 72 | 72 |
NFd: fileutils.GetTotalUsedFds(), |
| 73 | 73 |
NGoroutines: runtime.NumGoroutine(), |
| ... | ... |
@@ -96,15 +96,15 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
|
| 96 | 96 |
v.MemoryLimit = sysInfo.MemoryLimit |
| 97 | 97 |
v.SwapLimit = sysInfo.SwapLimit |
| 98 | 98 |
v.OomKillDisable = sysInfo.OomKillDisable |
| 99 |
- v.CpuCfsPeriod = sysInfo.CPUCfsPeriod |
|
| 100 |
- v.CpuCfsQuota = sysInfo.CPUCfsQuota |
|
| 99 |
+ v.CPUCfsPeriod = sysInfo.CPUCfsPeriod |
|
| 100 |
+ v.CPUCfsQuota = sysInfo.CPUCfsQuota |
|
| 101 | 101 |
} |
| 102 | 102 |
|
| 103 | 103 |
if httpProxy := os.Getenv("http_proxy"); httpProxy != "" {
|
| 104 |
- v.HttpProxy = httpProxy |
|
| 104 |
+ v.HTTPProxy = httpProxy |
|
| 105 | 105 |
} |
| 106 | 106 |
if httpsProxy := os.Getenv("https_proxy"); httpsProxy != "" {
|
| 107 |
- v.HttpsProxy = httpsProxy |
|
| 107 |
+ v.HTTPSProxy = httpsProxy |
|
| 108 | 108 |
} |
| 109 | 109 |
if noProxy := os.Getenv("no_proxy"); noProxy != "" {
|
| 110 | 110 |
v.NoProxy = noProxy |
| ... | ... |
@@ -55,7 +55,7 @@ func (daemon *Daemon) getInspectData(container *Container) (*types.ContainerJSON |
| 55 | 55 |
} |
| 56 | 56 |
|
| 57 | 57 |
contJSONBase := &types.ContainerJSONBase{
|
| 58 |
- Id: container.ID, |
|
| 58 |
+ ID: container.ID, |
|
| 59 | 59 |
Created: container.Created.Format(time.RFC3339Nano), |
| 60 | 60 |
Path: container.Path, |
| 61 | 61 |
Args: container.Args, |
| ... | ... |
@@ -26,7 +26,7 @@ func (daemon *Daemon) ContainerStats(name string, config *ContainerStatsConfig) |
| 26 | 26 |
config.OutStream.Write(nil) |
| 27 | 27 |
} |
| 28 | 28 |
|
| 29 |
- var preCpuStats types.CpuStats |
|
| 29 |
+ var preCpuStats types.CPUStats |
|
| 30 | 30 |
getStat := func(v interface{}) *types.Stats {
|
| 31 | 31 |
update := v.(*execdriver.ResourceStats) |
| 32 | 32 |
// Retrieve the nw statistics from libnetwork and inject them in the Stats |
| ... | ... |
@@ -34,11 +34,11 @@ func (daemon *Daemon) ContainerStats(name string, config *ContainerStatsConfig) |
| 34 | 34 |
update.Stats.Interfaces = nwStats |
| 35 | 35 |
} |
| 36 | 36 |
ss := convertStatsToAPITypes(update.Stats) |
| 37 |
- ss.PreCpuStats = preCpuStats |
|
| 37 |
+ ss.PreCPUStats = preCpuStats |
|
| 38 | 38 |
ss.MemoryStats.Limit = uint64(update.MemoryLimit) |
| 39 | 39 |
ss.Read = update.Read |
| 40 |
- ss.CpuStats.SystemUsage = update.SystemUsage |
|
| 41 |
- preCpuStats = ss.CpuStats |
|
| 40 |
+ ss.CPUStats.SystemUsage = update.SystemUsage |
|
| 41 |
+ preCpuStats = ss.CPUStats |
|
| 42 | 42 |
return ss |
| 43 | 43 |
} |
| 44 | 44 |
|
| ... | ... |
@@ -11,7 +11,7 @@ import ( |
| 11 | 11 |
func convertStatsToAPITypes(ls *libcontainer.Stats) *types.Stats {
|
| 12 | 12 |
s := &types.Stats{}
|
| 13 | 13 |
if ls.Interfaces != nil {
|
| 14 |
- s.Network = types.Network{}
|
|
| 14 |
+ s.Network = types.NetworkStats{}
|
|
| 15 | 15 |
for _, iface := range ls.Interfaces {
|
| 16 | 16 |
s.Network.RxBytes += iface.RxBytes |
| 17 | 17 |
s.Network.RxPackets += iface.RxPackets |
| ... | ... |
@@ -37,8 +37,8 @@ func convertStatsToAPITypes(ls *libcontainer.Stats) *types.Stats {
|
| 37 | 37 |
SectorsRecursive: copyBlkioEntry(cs.BlkioStats.SectorsRecursive), |
| 38 | 38 |
} |
| 39 | 39 |
cpu := cs.CpuStats |
| 40 |
- s.CpuStats = types.CpuStats{
|
|
| 41 |
- CpuUsage: types.CpuUsage{
|
|
| 40 |
+ s.CPUStats = types.CPUStats{
|
|
| 41 |
+ CPUUsage: types.CPUUsage{
|
|
| 42 | 42 |
TotalUsage: cpu.CpuUsage.TotalUsage, |
| 43 | 43 |
PercpuUsage: cpu.CpuUsage.PercpuUsage, |
| 44 | 44 |
UsageInKernelmode: cpu.CpuUsage.UsageInKernelmode, |
| ... | ... |
@@ -97,7 +97,7 @@ func (s *TagStore) Images(filterArgs, filter string, all bool) ([]*types.Image, |
| 97 | 97 |
} |
| 98 | 98 |
if filtTagged {
|
| 99 | 99 |
newImage := new(types.Image) |
| 100 |
- newImage.ParentId = image.Parent |
|
| 100 |
+ newImage.ParentID = image.Parent |
|
| 101 | 101 |
newImage.ID = image.ID |
| 102 | 102 |
newImage.Created = image.Created.Unix() |
| 103 | 103 |
newImage.Size = image.Size |
| ... | ... |
@@ -132,7 +132,7 @@ func (s *TagStore) Images(filterArgs, filter string, all bool) ([]*types.Image, |
| 132 | 132 |
continue |
| 133 | 133 |
} |
| 134 | 134 |
newImage := new(types.Image) |
| 135 |
- newImage.ParentId = image.Parent |
|
| 135 |
+ newImage.ParentID = image.Parent |
|
| 136 | 136 |
newImage.RepoTags = []string{"<none>:<none>"}
|
| 137 | 137 |
newImage.RepoDigests = []string{"<none>@<none>"}
|
| 138 | 138 |
newImage.ID = image.ID |
| ... | ... |
@@ -35,7 +35,7 @@ func (s *TagStore) Lookup(name string) (*types.ImageInspect, error) {
|
| 35 | 35 |
} |
| 36 | 36 |
|
| 37 | 37 |
imageInspect := &types.ImageInspect{
|
| 38 |
- Id: image.ID, |
|
| 38 |
+ ID: image.ID, |
|
| 39 | 39 |
Parent: image.Parent, |
| 40 | 40 |
Comment: image.Comment, |
| 41 | 41 |
Created: image.Created.Format(time.RFC3339Nano), |
| ... | ... |
@@ -38,8 +38,12 @@ func (s *DockerRegistrySuite) SetUpTest(c *check.C) {
|
| 38 | 38 |
} |
| 39 | 39 |
|
| 40 | 40 |
func (s *DockerRegistrySuite) TearDownTest(c *check.C) {
|
| 41 |
- s.reg.Close() |
|
| 42 |
- s.ds.TearDownTest(c) |
|
| 41 |
+ if s.reg != nil {
|
|
| 42 |
+ s.reg.Close() |
|
| 43 |
+ } |
|
| 44 |
+ if s.ds != nil {
|
|
| 45 |
+ s.ds.TearDownTest(c) |
|
| 46 |
+ } |
|
| 43 | 47 |
} |
| 44 | 48 |
|
| 45 | 49 |
func init() {
|
| ... | ... |
@@ -1057,11 +1057,11 @@ func (s *DockerSuite) TestContainerApiCreateWithCpuSharesCpuset(c *check.C) {
|
| 1057 | 1057 |
|
| 1058 | 1058 |
c.Assert(json.Unmarshal(body, &containerJSON), check.IsNil) |
| 1059 | 1059 |
|
| 1060 |
- out, err := inspectField(containerJSON.Id, "HostConfig.CpuShares") |
|
| 1060 |
+ out, err := inspectField(containerJSON.ID, "HostConfig.CpuShares") |
|
| 1061 | 1061 |
c.Assert(err, check.IsNil) |
| 1062 | 1062 |
c.Assert(out, check.Equals, "512") |
| 1063 | 1063 |
|
| 1064 |
- outCpuset, errCpuset := inspectField(containerJSON.Id, "HostConfig.CpusetCpus") |
|
| 1064 |
+ outCpuset, errCpuset := inspectField(containerJSON.ID, "HostConfig.CpusetCpus") |
|
| 1065 | 1065 |
c.Assert(errCpuset, check.IsNil, check.Commentf("Output: %s", outCpuset))
|
| 1066 | 1066 |
c.Assert(outCpuset, check.Equals, "0,1") |
| 1067 | 1067 |
} |
| ... | ... |
@@ -31,9 +31,9 @@ func (s *DockerSuite) TestCliStatsNoStreamGetCpu(c *check.C) {
|
| 31 | 31 |
body.Close() |
| 32 | 32 |
|
| 33 | 33 |
var cpuPercent = 0.0 |
| 34 |
- cpuDelta := float64(v.CpuStats.CpuUsage.TotalUsage - v.PreCpuStats.CpuUsage.TotalUsage) |
|
| 35 |
- systemDelta := float64(v.CpuStats.SystemUsage - v.PreCpuStats.SystemUsage) |
|
| 36 |
- cpuPercent = (cpuDelta / systemDelta) * float64(len(v.CpuStats.CpuUsage.PercpuUsage)) * 100.0 |
|
| 34 |
+ cpuDelta := float64(v.CPUStats.CPUUsage.TotalUsage - v.PreCPUStats.CPUUsage.TotalUsage) |
|
| 35 |
+ systemDelta := float64(v.CPUStats.SystemUsage - v.PreCPUStats.SystemUsage) |
|
| 36 |
+ cpuPercent = (cpuDelta / systemDelta) * float64(len(v.CPUStats.CPUUsage.PercpuUsage)) * 100.0 |
|
| 37 | 37 |
if cpuPercent == 0 {
|
| 38 | 38 |
c.Fatalf("docker stats with no-stream get cpu usage failed: was %v", cpuPercent)
|
| 39 | 39 |
} |
| ... | ... |
@@ -106,7 +106,7 @@ func (s *DockerSuite) TestApiNetworkStats(c *check.C) {
|
| 106 | 106 |
check.Commentf("Reported less Txbytes than expected. Expected >= %d. Found %d. %s", expRxPkts, nwStatsPost.RxPackets, pingouts))
|
| 107 | 107 |
} |
| 108 | 108 |
|
| 109 |
-func getNetworkStats(c *check.C, id string) types.Network {
|
|
| 109 |
+func getNetworkStats(c *check.C, id string) types.NetworkStats {
|
|
| 110 | 110 |
var st *types.Stats |
| 111 | 111 |
|
| 112 | 112 |
_, body, err := sockRequestRaw("GET", fmt.Sprintf("/containers/%s/stats?stream=false", id), nil, "")
|