Browse code

update containerd to v1.2.1

Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Andrew Hsu authored on 2018/12/06 13:28:35
Showing 12 changed files
... ...
@@ -79,7 +79,7 @@ google.golang.org/grpc v1.12.0
79 79
 # the containerd project first, and update both after that is merged.
80 80
 # This commit does not need to match RUNC_COMMIT as it is used for helper
81 81
 # packages but should be newer or equal.
82
-github.com/opencontainers/runc 10d38b660a77168360df3522881e2dc2be5056bd
82
+github.com/opencontainers/runc 96ec2177ae841256168fcf76954f7177af9446eb
83 83
 github.com/opencontainers/runtime-spec 5684b8af48c1ac3b1451fa499724e30e3c20a294 # v1.0.1-49-g5684b8a
84 84
 github.com/opencontainers/image-spec v1.0.1
85 85
 github.com/seccomp/libseccomp-golang 32f571b70023028bd57d9288c20efbcb237f3ce0
... ...
@@ -118,12 +118,12 @@ github.com/googleapis/gax-go v2.0.0
118 118
 google.golang.org/genproto 694d95ba50e67b2e363f3483057db5d4910c18f9
119 119
 
120 120
 # containerd
121
-github.com/containerd/containerd de1f167ab96338a9f5c2b17347abf84bdf1dd411 # v1.2.1-rc.0
121
+github.com/containerd/containerd 9b32062dc1f5a7c2564315c269b5059754f12b9d # v1.2.1
122 122
 github.com/containerd/fifo 3d5202aec260678c48179c56f40e6f38a095738c
123 123
 github.com/containerd/continuity bd77b46c8352f74eb12c85bdc01f4b90f69d66b4
124 124
 github.com/containerd/cgroups 5e610833b72089b37d0e615de9a92dfc043757c2
125 125
 github.com/containerd/console c12b1e7919c14469339a5d38f2f8ed9b64a9de23
126
-github.com/containerd/cri f913714917d2456d7e65a0be84962b1ce8acb487 # release/1.2 branch
126
+github.com/containerd/cri 0ca1e3c2b73b5c38e72f29bb76338d0078b23d6c # release/1.2 branch
127 127
 github.com/containerd/go-runc 5a6d9f37cfa36b15efba46dc7ea349fa9b7143c3
128 128
 github.com/containerd/typeurl a93fcdb778cd272c6e9b3028b2f42d813e785d40
129 129
 github.com/containerd/ttrpc 2a805f71863501300ae1976d29f0454ae003e85a
... ...
@@ -209,6 +209,7 @@ func populateDefaultUnixSpec(ctx context.Context, s *Spec, id string) error {
209 209
 		Linux: &specs.Linux{
210 210
 			MaskedPaths: []string{
211 211
 				"/proc/acpi",
212
+				"/proc/asound",
212 213
 				"/proc/kcore",
213 214
 				"/proc/keys",
214 215
 				"/proc/latency_stats",
... ...
@@ -219,7 +220,6 @@ func populateDefaultUnixSpec(ctx context.Context, s *Spec, id string) error {
219 219
 				"/proc/scsi",
220 220
 			},
221 221
 			ReadonlyPaths: []string{
222
-				"/proc/asound",
223 222
 				"/proc/bus",
224 223
 				"/proc/fs",
225 224
 				"/proc/irq",
... ...
@@ -69,3 +69,7 @@ func (s *deletedState) SetExited(status int) {
69 69
 func (s *deletedState) Exec(ctx context.Context, path string, r *ExecConfig) (proc.Process, error) {
70 70
 	return nil, errors.Errorf("cannot exec in a deleted state")
71 71
 }
72
+
73
+func (s *deletedState) Pid() int {
74
+	return -1
75
+}
... ...
@@ -69,8 +69,10 @@ func (e *execProcess) ID() string {
69 69
 }
70 70
 
71 71
 func (e *execProcess) Pid() int {
72
-	e.mu.Lock()
73
-	defer e.mu.Unlock()
72
+	return e.execState.Pid()
73
+}
74
+
75
+func (e *execProcess) pidv() int {
74 76
 	return e.pid
75 77
 }
76 78
 
... ...
@@ -31,6 +31,7 @@ type execState interface {
31 31
 	Delete(context.Context) error
32 32
 	Kill(context.Context, uint32, bool) error
33 33
 	SetExited(int)
34
+	Pid() int
34 35
 }
35 36
 
36 37
 type execCreatedState struct {
... ...
@@ -82,6 +83,12 @@ func (s *execCreatedState) SetExited(status int) {
82 82
 	}
83 83
 }
84 84
 
85
+func (s *execCreatedState) Pid() int {
86
+	s.p.mu.Lock()
87
+	defer s.p.mu.Unlock()
88
+	return s.p.pidv()
89
+}
90
+
85 91
 type execRunningState struct {
86 92
 	p *execProcess
87 93
 }
... ...
@@ -120,6 +127,12 @@ func (s *execRunningState) SetExited(status int) {
120 120
 	}
121 121
 }
122 122
 
123
+func (s *execRunningState) Pid() int {
124
+	s.p.mu.Lock()
125
+	defer s.p.mu.Unlock()
126
+	return s.p.pidv()
127
+}
128
+
123 129
 type execStoppedState struct {
124 130
 	p *execProcess
125 131
 }
... ...
@@ -157,3 +170,7 @@ func (s *execStoppedState) Kill(ctx context.Context, sig uint32, all bool) error
157 157
 func (s *execStoppedState) SetExited(status int) {
158 158
 	// no op
159 159
 }
160
+
161
+func (s *execStoppedState) Pid() int {
162
+	return s.p.pidv()
163
+}
... ...
@@ -24,7 +24,6 @@ import (
24 24
 	"syscall"
25 25
 
26 26
 	"github.com/containerd/console"
27
-	"github.com/containerd/containerd/errdefs"
28 27
 	"github.com/containerd/containerd/runtime/proc"
29 28
 	"github.com/containerd/fifo"
30 29
 	runc "github.com/containerd/go-runc"
... ...
@@ -407,7 +406,7 @@ func (s *stoppedState) Delete(ctx context.Context) error {
407 407
 }
408 408
 
409 409
 func (s *stoppedState) Kill(ctx context.Context, sig uint32, all bool) error {
410
-	return errdefs.ToGRPCf(errdefs.ErrNotFound, "process %s not found", s.p.id)
410
+	return s.p.kill(ctx, sig, all)
411 411
 }
412 412
 
413 413
 func (s *stoppedState) SetExited(status int) {
... ...
@@ -93,7 +93,9 @@ func checkKillError(err error) error {
93 93
 	if err == nil {
94 94
 		return nil
95 95
 	}
96
-	if strings.Contains(err.Error(), "os: process already finished") || err == unix.ESRCH {
96
+	if strings.Contains(err.Error(), "os: process already finished") ||
97
+		strings.Contains(err.Error(), "container not running") ||
98
+		err == unix.ESRCH {
97 99
 		return errors.Wrapf(errdefs.ErrNotFound, "process already finished")
98 100
 	}
99 101
 	return errors.Wrapf(err, "unknown error after kill")
... ...
@@ -20,7 +20,7 @@ github.com/gogo/protobuf v1.0.0
20 20
 github.com/gogo/googleapis 08a7655d27152912db7aaf4f983275eaf8d128ef
21 21
 github.com/golang/protobuf v1.1.0
22 22
 github.com/opencontainers/runtime-spec eba862dc2470385a233c7507392675cbeadf7353 # v1.0.1-45-geba862d
23
-github.com/opencontainers/runc 10d38b660a77168360df3522881e2dc2be5056bd
23
+github.com/opencontainers/runc 96ec2177ae841256168fcf76954f7177af9446eb
24 24
 github.com/sirupsen/logrus v1.0.0
25 25
 github.com/urfave/cli 7bc6a0acffa589f415f88aca16cc1de5ffd66f9c
26 26
 golang.org/x/net b3756b4b77d7b13260a0a2ec658753cf48922eac
... ...
@@ -43,7 +43,7 @@ github.com/google/go-cmp v0.1.0
43 43
 go.etcd.io/bbolt v1.3.1-etcd.8
44 44
 
45 45
 # cri dependencies
46
-github.com/containerd/cri 2bb57d27203d82fc79c496aea724aec593b2705a # release/1.2 branch
46
+github.com/containerd/cri 0ca1e3c2b73b5c38e72f29bb76338d0078b23d6c # release/1.2 branch
47 47
 github.com/containerd/go-cni 40bcf8ec8acd7372be1d77031d585d5d8e561c90
48 48
 github.com/blang/semver v3.1.0
49 49
 github.com/containernetworking/cni v0.6.0
... ...
@@ -3,7 +3,7 @@ github.com/blang/semver v3.1.0
3 3
 github.com/BurntSushi/toml a368813c5e648fee92e5f6c30e3944ff9d5e8895
4 4
 github.com/containerd/cgroups 5e610833b72089b37d0e615de9a92dfc043757c2
5 5
 github.com/containerd/console c12b1e7919c14469339a5d38f2f8ed9b64a9de23
6
-github.com/containerd/containerd 15f19d7a67fa322e6de0ef4c6a1bf9da0f056554
6
+github.com/containerd/containerd 4b284fa3ab61832b022ba428055f793a75ffc251
7 7
 github.com/containerd/continuity bd77b46c8352f74eb12c85bdc01f4b90f69d66b4
8 8
 github.com/containerd/fifo 3d5202aec260678c48179c56f40e6f38a095738c
9 9
 github.com/containerd/go-cni 40bcf8ec8acd7372be1d77031d585d5d8e561c90
... ...
@@ -33,13 +33,13 @@ github.com/hashicorp/errwrap 7554cd9344cec97297fa6649b055a8c98c2a1e55
33 33
 github.com/hashicorp/go-multierror ed905158d87462226a13fe39ddf685ea65f1c11f
34 34
 github.com/json-iterator/go 1.1.5
35 35
 github.com/matttproud/golang_protobuf_extensions v1.0.0
36
-github.com/Microsoft/go-winio v0.4.10
37
-github.com/Microsoft/hcsshim v0.7.6
36
+github.com/Microsoft/go-winio v0.4.11
37
+github.com/Microsoft/hcsshim v0.8.1
38 38
 github.com/modern-go/concurrent 1.0.3
39 39
 github.com/modern-go/reflect2 1.0.1
40 40
 github.com/opencontainers/go-digest c9281466c8b2f606084ac71339773efd177436e7
41 41
 github.com/opencontainers/image-spec v1.0.1
42
-github.com/opencontainers/runc 00dc70017d222b178a002ed30e9321b12647af2d
42
+github.com/opencontainers/runc v1.0.0-rc6
43 43
 github.com/opencontainers/runtime-spec eba862dc2470385a233c7507392675cbeadf7353
44 44
 github.com/opencontainers/runtime-tools v0.6.0
45 45
 github.com/opencontainers/selinux b6fa367ed7f534f9ba25391cc2d467085dbb445a
... ...
@@ -22,31 +22,41 @@ const (
22 22
 )
23 23
 
24 24
 // https://www.kernel.org/doc/Documentation/cgroup-v1/cgroups.txt
25
-func FindCgroupMountpoint(subsystem string) (string, error) {
26
-	mnt, _, err := FindCgroupMountpointAndRoot(subsystem)
25
+func FindCgroupMountpoint(cgroupPath, subsystem string) (string, error) {
26
+	mnt, _, err := FindCgroupMountpointAndRoot(cgroupPath, subsystem)
27 27
 	return mnt, err
28 28
 }
29 29
 
30
-func FindCgroupMountpointAndRoot(subsystem string) (string, string, error) {
30
+func FindCgroupMountpointAndRoot(cgroupPath, subsystem string) (string, string, error) {
31 31
 	// We are not using mount.GetMounts() because it's super-inefficient,
32 32
 	// parsing it directly sped up x10 times because of not using Sscanf.
33 33
 	// It was one of two major performance drawbacks in container start.
34 34
 	if !isSubsystemAvailable(subsystem) {
35 35
 		return "", "", NewNotFoundError(subsystem)
36 36
 	}
37
+
37 38
 	f, err := os.Open("/proc/self/mountinfo")
38 39
 	if err != nil {
39 40
 		return "", "", err
40 41
 	}
41 42
 	defer f.Close()
42 43
 
43
-	scanner := bufio.NewScanner(f)
44
+	return findCgroupMountpointAndRootFromReader(f, cgroupPath, subsystem)
45
+}
46
+
47
+func findCgroupMountpointAndRootFromReader(reader io.Reader, cgroupPath, subsystem string) (string, string, error) {
48
+	scanner := bufio.NewScanner(reader)
44 49
 	for scanner.Scan() {
45 50
 		txt := scanner.Text()
46
-		fields := strings.Split(txt, " ")
47
-		for _, opt := range strings.Split(fields[len(fields)-1], ",") {
48
-			if opt == subsystem {
49
-				return fields[4], fields[3], nil
51
+		fields := strings.Fields(txt)
52
+		if len(fields) < 5 {
53
+			continue
54
+		}
55
+		if strings.HasPrefix(fields[4], cgroupPath) {
56
+			for _, opt := range strings.Split(fields[len(fields)-1], ",") {
57
+				if opt == subsystem {
58
+					return fields[4], fields[3], nil
59
+				}
50 60
 			}
51 61
 		}
52 62
 	}
... ...
@@ -257,7 +267,7 @@ func GetInitCgroupPath(subsystem string) (string, error) {
257 257
 }
258 258
 
259 259
 func getCgroupPathHelper(subsystem, cgroup string) (string, error) {
260
-	mnt, root, err := FindCgroupMountpointAndRoot(subsystem)
260
+	mnt, root, err := FindCgroupMountpointAndRoot("", subsystem)
261 261
 	if err != nil {
262 262
 		return "", err
263 263
 	}
... ...
@@ -272,26 +272,23 @@ func (hooks Hooks) MarshalJSON() ([]byte, error) {
272 272
 	})
273 273
 }
274 274
 
275
-// HookState is the payload provided to a hook on execution.
276
-type HookState specs.State
277
-
278 275
 type Hook interface {
279 276
 	// Run executes the hook with the provided state.
280
-	Run(HookState) error
277
+	Run(*specs.State) error
281 278
 }
282 279
 
283 280
 // NewFunctionHook will call the provided function when the hook is run.
284
-func NewFunctionHook(f func(HookState) error) FuncHook {
281
+func NewFunctionHook(f func(*specs.State) error) FuncHook {
285 282
 	return FuncHook{
286 283
 		run: f,
287 284
 	}
288 285
 }
289 286
 
290 287
 type FuncHook struct {
291
-	run func(HookState) error
288
+	run func(*specs.State) error
292 289
 }
293 290
 
294
-func (f FuncHook) Run(s HookState) error {
291
+func (f FuncHook) Run(s *specs.State) error {
295 292
 	return f.run(s)
296 293
 }
297 294
 
... ...
@@ -314,7 +311,7 @@ type CommandHook struct {
314 314
 	Command
315 315
 }
316 316
 
317
-func (c Command) Run(s HookState) error {
317
+func (c Command) Run(s *specs.State) error {
318 318
 	b, err := json.Marshal(s)
319 319
 	if err != nil {
320 320
 		return err
... ...
@@ -5,7 +5,9 @@ type IntelRdt struct {
5 5
 	// Format: "L3:<cache_id0>=<cbm0>;<cache_id1>=<cbm1>;..."
6 6
 	L3CacheSchema string `json:"l3_cache_schema,omitempty"`
7 7
 
8
-	// The schema of memory bandwidth percentage per L3 cache id
8
+	// The schema of memory bandwidth per L3 cache id
9 9
 	// Format: "MB:<cache_id0>=bandwidth0;<cache_id1>=bandwidth1;..."
10
+	// The unit of memory bandwidth is specified in "percentages" by
11
+	// default, and in "MBps" if MBA Software Controller is enabled.
10 12
 	MemBwSchema string `json:"memBwSchema,omitempty"`
11 13
 }