Browse code

update containerd client and dependencies to v1.2.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2018/10/19 04:37:23
Showing 118 changed files
... ...
@@ -15,7 +15,7 @@ import (
15 15
 
16 16
 	"github.com/BurntSushi/toml"
17 17
 	"github.com/containerd/containerd"
18
-	"github.com/containerd/containerd/services/server"
18
+	"github.com/containerd/containerd/services/server/config"
19 19
 	"github.com/docker/docker/pkg/system"
20 20
 	"github.com/pkg/errors"
21 21
 	"github.com/sirupsen/logrus"
... ...
@@ -37,7 +37,7 @@ type pluginConfigs struct {
37 37
 
38 38
 type remote struct {
39 39
 	sync.RWMutex
40
-	server.Config
40
+	config.Config
41 41
 
42 42
 	daemonPid int
43 43
 	logger    *logrus.Entry
... ...
@@ -65,7 +65,7 @@ func Start(ctx context.Context, rootDir, stateDir string, opts ...DaemonOpt) (Da
65 65
 	r := &remote{
66 66
 		rootDir:  rootDir,
67 67
 		stateDir: stateDir,
68
-		Config: server.Config{
68
+		Config: config.Config{
69 69
 			Root:  filepath.Join(rootDir, "daemon"),
70 70
 			State: filepath.Join(stateDir, "daemon"),
71 71
 		},
... ...
@@ -1,6 +1,6 @@
1 1
 # the following lines are in sorted order, FYI
2 2
 github.com/Azure/go-ansiterm d6e3b3328b783f23731bc4d058875b0371ff8109
3
-github.com/Microsoft/hcsshim v0.7.9
3
+github.com/Microsoft/hcsshim v0.7.12
4 4
 github.com/Microsoft/go-winio v0.4.11
5 5
 github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a
6 6
 github.com/go-check/check 4ed411733c5785b40214c70bce814c3a3a689609 https://github.com/cpuguy83/check.git
... ...
@@ -75,8 +75,8 @@ github.com/pborman/uuid v1.0
75 75
 google.golang.org/grpc v1.12.0
76 76
 
77 77
 # This does not need to match RUNC_COMMIT as it is used for helper packages but should be newer or equal
78
-github.com/opencontainers/runc a00bf0190895aa465a5fbed0268888e2c8ddfe85
79
-github.com/opencontainers/runtime-spec eba862dc2470385a233c7507392675cbeadf7353 # v1.0.1-45-geba862d
78
+github.com/opencontainers/runc 58592df56734acf62e574865fe40b9e53e967910
79
+github.com/opencontainers/runtime-spec 5684b8af48c1ac3b1451fa499724e30e3c20a294 # v1.0.1-49-g5684b8a
80 80
 github.com/opencontainers/image-spec v1.0.1
81 81
 github.com/seccomp/libseccomp-golang 32f571b70023028bd57d9288c20efbcb237f3ce0
82 82
 
... ...
@@ -114,12 +114,12 @@ github.com/googleapis/gax-go v2.0.0
114 114
 google.golang.org/genproto 694d95ba50e67b2e363f3483057db5d4910c18f9
115 115
 
116 116
 # containerd
117
-github.com/containerd/containerd 0c5f8f63c3368856c320ae8a1c125e703b73b51d # v1.2.0-rc.1
117
+github.com/containerd/containerd c4446665cb9c30056f4998ed953e6d4ff22c7c39 # v1.2.0
118 118
 github.com/containerd/fifo 3d5202aec260678c48179c56f40e6f38a095738c
119 119
 github.com/containerd/continuity bd77b46c8352f74eb12c85bdc01f4b90f69d66b4
120 120
 github.com/containerd/cgroups 5e610833b72089b37d0e615de9a92dfc043757c2
121 121
 github.com/containerd/console c12b1e7919c14469339a5d38f2f8ed9b64a9de23
122
-github.com/containerd/cri 9f39e3289533fc228c5e5fcac0a6dbdd60c6047b # release/1.2 branch
122
+github.com/containerd/cri f913714917d2456d7e65a0be84962b1ce8acb487 # release/1.2 branch
123 123
 github.com/containerd/go-runc 5a6d9f37cfa36b15efba46dc7ea349fa9b7143c3
124 124
 github.com/containerd/typeurl a93fcdb778cd272c6e9b3028b2f42d813e785d40
125 125
 github.com/containerd/ttrpc 2a805f71863501300ae1976d29f0454ae003e85a
... ...
@@ -6,6 +6,7 @@ import (
6 6
 
7 7
 // HNSEndpoint represents a network endpoint in HNS
8 8
 type HNSEndpoint = hns.HNSEndpoint
9
+
9 10
 // Namespace represents a Compartment.
10 11
 type Namespace = hns.Namespace
11 12
 
12 13
new file mode 100644
... ...
@@ -0,0 +1,85 @@
0
+package guestrequest
1
+
2
+import "github.com/Microsoft/hcsshim/internal/schema2"
3
+
4
+// Arguably, many of these (at least CombinedLayers) should have been generated
5
+// by swagger.
6
+//
7
+// This will also change package name due to an inbound breaking change.
8
+
9
+// This class is used by a modify request to add or remove a combined layers
10
+// structure in the guest. For windows, the GCS applies a filter in ContainerRootPath
11
+// using the specified layers as the parent content. Ignores property ScratchPath
12
+// since the container path is already the scratch path. For linux, the GCS unions
13
+// the specified layers and ScratchPath together, placing the resulting union
14
+// filesystem at ContainerRootPath.
15
+type CombinedLayers struct {
16
+	ContainerRootPath string            `json:"ContainerRootPath,omitempty"`
17
+	Layers            []hcsschema.Layer `json:"Layers,omitempty"`
18
+	ScratchPath       string            `json:"ScratchPath,omitempty"`
19
+}
20
+
21
+// Defines the schema for hosted settings passed to GCS and/or OpenGCS
22
+
23
+// SCSI. Scratch space for remote file-system commands, or R/W layer for containers
24
+type LCOWMappedVirtualDisk struct {
25
+	MountPath  string `json:"MountPath,omitempty"` // /tmp/scratch for an LCOW utility VM being used as a service VM
26
+	Lun        uint8  `json:"Lun,omitempty"`
27
+	Controller uint8  `json:"Controller,omitempty"`
28
+	ReadOnly   bool   `json:"ReadOnly,omitempty"`
29
+}
30
+
31
+type WCOWMappedVirtualDisk struct {
32
+	ContainerPath string `json:"ContainerPath,omitempty"`
33
+	Lun           int32  `json:"Lun,omitempty"`
34
+}
35
+
36
+type LCOWMappedDirectory struct {
37
+	MountPath string `json:"MountPath,omitempty"`
38
+	Port      int32  `json:"Port,omitempty"`
39
+	ShareName string `json:"ShareName,omitempty"` // If empty not using ANames (not currently supported)
40
+	ReadOnly  bool   `json:"ReadOnly,omitempty"`
41
+}
42
+
43
+// Read-only layers over VPMem
44
+type LCOWMappedVPMemDevice struct {
45
+	DeviceNumber uint32 `json:"DeviceNumber,omitempty"`
46
+	MountPath    string `json:"MountPath,omitempty"` // /tmp/pN
47
+}
48
+
49
+type ResourceType string
50
+
51
+const (
52
+	// These are constants for v2 schema modify guest requests.
53
+	ResourceTypeMappedDirectory   ResourceType = "MappedDirectory"
54
+	ResourceTypeMappedVirtualDisk ResourceType = "MappedVirtualDisk"
55
+	ResourceTypeNetwork           ResourceType = "Network"
56
+	ResourceTypeNetworkNamespace  ResourceType = "NetworkNamespace"
57
+	ResourceTypeCombinedLayers    ResourceType = "CombinedLayers"
58
+	ResourceTypeVPMemDevice       ResourceType = "VPMemDevice"
59
+)
60
+
61
+// GuestRequest is for modify commands passed to the guest.
62
+type GuestRequest struct {
63
+	RequestType  string       `json:"RequestType,omitempty"`
64
+	ResourceType ResourceType `json:"ResourceType,omitempty"`
65
+	Settings     interface{}  `json:"Settings,omitempty"`
66
+}
67
+
68
+type NetworkModifyRequest struct {
69
+	AdapterId   string      `json:"AdapterId,omitempty"`
70
+	RequestType string      `json:"RequestType,omitempty"`
71
+	Settings    interface{} `json:"Settings,omitempty"`
72
+}
73
+
74
+type RS4NetworkModifyRequest struct {
75
+	AdapterInstanceId string      `json:"AdapterInstanceId,omitempty"`
76
+	RequestType       string      `json:"RequestType,omitempty"`
77
+	Settings          interface{} `json:"Settings,omitempty"`
78
+}
79
+
80
+// SignalProcessOptions is the options passed to either WCOW or LCOW
81
+// to signal a given process.
82
+type SignalProcessOptions struct {
83
+	Signal int `json:,omitempty`
84
+}
... ...
@@ -27,6 +27,7 @@ import (
27 27
 //sys hcsOpenProcess(computeSystem hcsSystem, pid uint32, process *hcsProcess, result **uint16) (hr error) = vmcompute.HcsOpenProcess?
28 28
 //sys hcsCloseProcess(process hcsProcess) (hr error) = vmcompute.HcsCloseProcess?
29 29
 //sys hcsTerminateProcess(process hcsProcess, result **uint16) (hr error) = vmcompute.HcsTerminateProcess?
30
+//sys hcsSignalProcess(process hcsProcess, options string, result **uint16) (hr error) = vmcompute.HcsTerminateProcess?
30 31
 //sys hcsGetProcessInfo(process hcsProcess, processInformation *hcsProcessInformation, result **uint16) (hr error) = vmcompute.HcsGetProcessInfo?
31 32
 //sys hcsGetProcessProperties(process hcsProcess, processProperties **uint16, result **uint16) (hr error) = vmcompute.HcsGetProcessProperties?
32 33
 //sys hcsModifyProcess(process hcsProcess, settings string, result **uint16) (hr error) = vmcompute.HcsModifyProcess?
... ...
@@ -8,6 +8,7 @@ import (
8 8
 	"syscall"
9 9
 	"time"
10 10
 
11
+	"github.com/Microsoft/hcsshim/internal/guestrequest"
11 12
 	"github.com/Microsoft/hcsshim/internal/interop"
12 13
 	"github.com/sirupsen/logrus"
13 14
 )
... ...
@@ -71,6 +72,39 @@ func (process *Process) SystemID() string {
71 71
 	return process.system.ID()
72 72
 }
73 73
 
74
+// Signal signals the process with `options`.
75
+func (process *Process) Signal(options guestrequest.SignalProcessOptions) error {
76
+	process.handleLock.RLock()
77
+	defer process.handleLock.RUnlock()
78
+	operation := "Signal"
79
+	title := "hcsshim::Process::" + operation
80
+	logrus.Debugf(title+" processid=%d", process.processID)
81
+
82
+	if process.handle == 0 {
83
+		return makeProcessError(process, operation, ErrAlreadyClosed, nil)
84
+	}
85
+
86
+	optionsb, err := json.Marshal(options)
87
+	if err != nil {
88
+		return err
89
+	}
90
+
91
+	optionsStr := string(optionsb)
92
+
93
+	var resultp *uint16
94
+	completed := false
95
+	go syscallWatcher(fmt.Sprintf("SignalProcess %s: %d", process.SystemID(), process.Pid()), &completed)
96
+	err = hcsSignalProcess(process.handle, optionsStr, &resultp)
97
+	completed = true
98
+	events := processHcsResult(resultp)
99
+	if err != nil {
100
+		return makeProcessError(process, operation, err, events)
101
+	}
102
+
103
+	logrus.Debugf(title+" succeeded processid=%d", process.processID)
104
+	return nil
105
+}
106
+
74 107
 // Kill signals the process to terminate but does not wait for it to finish terminating.
75 108
 func (process *Process) Kill() error {
76 109
 	process.handleLock.RLock()
... ...
@@ -57,12 +57,13 @@ var (
57 57
 	procHcsOpenProcess                     = modvmcompute.NewProc("HcsOpenProcess")
58 58
 	procHcsCloseProcess                    = modvmcompute.NewProc("HcsCloseProcess")
59 59
 	procHcsTerminateProcess                = modvmcompute.NewProc("HcsTerminateProcess")
60
-	procHcsGetProcessInfo                  = modvmcompute.NewProc("HcsGetProcessInfo")
61
-	procHcsGetProcessProperties            = modvmcompute.NewProc("HcsGetProcessProperties")
62
-	procHcsModifyProcess                   = modvmcompute.NewProc("HcsModifyProcess")
63
-	procHcsGetServiceProperties            = modvmcompute.NewProc("HcsGetServiceProperties")
64
-	procHcsRegisterProcessCallback         = modvmcompute.NewProc("HcsRegisterProcessCallback")
65
-	procHcsUnregisterProcessCallback       = modvmcompute.NewProc("HcsUnregisterProcessCallback")
60
+
61
+	procHcsGetProcessInfo            = modvmcompute.NewProc("HcsGetProcessInfo")
62
+	procHcsGetProcessProperties      = modvmcompute.NewProc("HcsGetProcessProperties")
63
+	procHcsModifyProcess             = modvmcompute.NewProc("HcsModifyProcess")
64
+	procHcsGetServiceProperties      = modvmcompute.NewProc("HcsGetServiceProperties")
65
+	procHcsRegisterProcessCallback   = modvmcompute.NewProc("HcsRegisterProcessCallback")
66
+	procHcsUnregisterProcessCallback = modvmcompute.NewProc("HcsUnregisterProcessCallback")
66 67
 )
67 68
 
68 69
 func hcsEnumerateComputeSystems(query string, computeSystems **uint16, result **uint16) (hr error) {
... ...
@@ -356,6 +357,26 @@ func hcsTerminateProcess(process hcsProcess, result **uint16) (hr error) {
356 356
 	return
357 357
 }
358 358
 
359
+func hcsSignalProcess(process hcsProcess, options string, result **uint16) (hr error) {
360
+	var _p0 *uint16
361
+	_p0, hr = syscall.UTF16PtrFromString(options)
362
+	if hr != nil {
363
+		return
364
+	}
365
+	return _hcsSignalProcess(process, _p0, result)
366
+}
367
+
368
+func _hcsSignalProcess(process hcsProcess, options *uint16, result **uint16) (hr error) {
369
+	if hr = procHcsTerminateProcess.Find(); hr != nil {
370
+		return
371
+	}
372
+	r0, _, _ := syscall.Syscall(procHcsTerminateProcess.Addr(), 3, uintptr(process), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result)))
373
+	if int32(r0) < 0 {
374
+		hr = interop.Win32FromHresult(r0)
375
+	}
376
+	return
377
+}
378
+
359 379
 func hcsGetProcessInfo(process hcsProcess, processInformation *hcsProcessInformation, result **uint16) (hr error) {
360 380
 	if hr = procHcsGetProcessInfo.Find(); hr != nil {
361 381
 		return
... ...
@@ -3,6 +3,8 @@ package schema1
3 3
 import (
4 4
 	"encoding/json"
5 5
 	"time"
6
+
7
+	"github.com/Microsoft/hcsshim/internal/schema2"
6 8
 )
7 9
 
8 10
 // ProcessConfig is used as both the input of Container.CreateProcess
... ...
@@ -115,9 +117,10 @@ type ComputeSystemQuery struct {
115 115
 type PropertyType string
116 116
 
117 117
 const (
118
-	PropertyTypeStatistics        PropertyType = "Statistics"
119
-	PropertyTypeProcessList                    = "ProcessList"
120
-	PropertyTypeMappedVirtualDisk              = "MappedVirtualDisk"
118
+	PropertyTypeStatistics        PropertyType = "Statistics"        // V1 and V2
119
+	PropertyTypeProcessList                    = "ProcessList"       // V1 and V2
120
+	PropertyTypeMappedVirtualDisk              = "MappedVirtualDisk" // Not supported in V2 schema call
121
+	PropertyTypeGuestConnection                = "GuestConnection"   // V1 and V2. Nil return from HCS before RS5
121 122
 )
122 123
 
123 124
 type PropertyQuery struct {
... ...
@@ -142,6 +145,7 @@ type ContainerProperties struct {
142 142
 	Statistics                   Statistics                          `json:",omitempty"`
143 143
 	ProcessList                  []ProcessListItem                   `json:",omitempty"`
144 144
 	MappedVirtualDiskControllers map[int]MappedVirtualDiskController `json:",omitempty"`
145
+	GuestConnectionInfo          GuestConnectionInfo                 `json:",omitempty"`
145 146
 }
146 147
 
147 148
 // MemoryStats holds the memory statistics for a container
... ...
@@ -206,6 +210,19 @@ type MappedVirtualDiskController struct {
206 206
 	MappedVirtualDisks map[int]MappedVirtualDisk `json:",omitempty"`
207 207
 }
208 208
 
209
+// GuestDefinedCapabilities is part of the GuestConnectionInfo returned by a GuestConnection call on a utility VM
210
+type GuestDefinedCapabilities struct {
211
+	NamespaceAddRequestSupported bool `json:",omitempty"`
212
+	SignalProcessSupported       bool `json:",omitempty"`
213
+}
214
+
215
+// GuestConnectionInfo is the structure of an iterm return by a GuestConnection call on a utility VM
216
+type GuestConnectionInfo struct {
217
+	SupportedSchemaVersions  []hcsschema.Version      `json:",omitempty"`
218
+	ProtocolVersion          uint32                   `json:",omitempty"`
219
+	GuestDefinedCapabilities GuestDefinedCapabilities `json:",omitempty"`
220
+}
221
+
209 222
 // Type of Request Support in ModifySystem
210 223
 type RequestType string
211 224
 
212 225
new file mode 100644
... ...
@@ -0,0 +1,31 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type Attachment struct {
12
+
13
+	Type_ string `json:"Type,omitempty"`
14
+
15
+	Path string `json:"Path,omitempty"`
16
+
17
+	IgnoreFlushes bool `json:"IgnoreFlushes,omitempty"`
18
+
19
+	CachingMode string `json:"CachingMode,omitempty"`
20
+
21
+	NoWriteHardening bool `json:"NoWriteHardening,omitempty"`
22
+
23
+	DisableExpansionOptimization bool `json:"DisableExpansionOptimization,omitempty"`
24
+
25
+	IgnoreRelativeLocator bool `json:"IgnoreRelativeLocator,omitempty"`
26
+
27
+	CaptureIoAttributionContext bool `json:"CaptureIoAttributionContext,omitempty"`
28
+
29
+	ReadOnly bool `json:"ReadOnly,omitempty"`
30
+}
0 31
new file mode 100644
... ...
@@ -0,0 +1,13 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type Battery struct {
12
+}
0 13
new file mode 100644
... ...
@@ -0,0 +1,19 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type CacheQueryStatsResponse struct {
12
+
13
+	L3OccupancyBytes int32 `json:"L3OccupancyBytes,omitempty"`
14
+
15
+	L3TotalBwBytes int32 `json:"L3TotalBwBytes,omitempty"`
16
+
17
+	L3LocalBwBytes int32 `json:"L3LocalBwBytes,omitempty"`
18
+}
0 19
new file mode 100644
... ...
@@ -0,0 +1,25 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type Chipset struct {
12
+
13
+	Uefi *Uefi `json:"Uefi,omitempty"`
14
+
15
+	IsNumLockDisabled bool `json:"IsNumLockDisabled,omitempty"`
16
+
17
+	BaseBoardSerialNumber string `json:"BaseBoardSerialNumber,omitempty"`
18
+
19
+	ChassisSerialNumber string `json:"ChassisSerialNumber,omitempty"`
20
+
21
+	ChassisAssetTag string `json:"ChassisAssetTag,omitempty"`
22
+
23
+	UseUtc bool `json:"UseUtc,omitempty"`
24
+}
0 25
new file mode 100644
... ...
@@ -0,0 +1,15 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type CloseHandle struct {
12
+
13
+	Handle string `json:"Handle,omitempty"`
14
+}
0 15
new file mode 100644
... ...
@@ -0,0 +1,18 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+//  ComPort specifies the named pipe that will be used for the port, with empty string indicating a disconnected port.
12
+type ComPort struct {
13
+
14
+	NamedPipe string `json:"NamedPipe,omitempty"`
15
+
16
+	OptimizeForDebugger bool `json:"OptimizeForDebugger,omitempty"`
17
+}
0 18
new file mode 100644
... ...
@@ -0,0 +1,27 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type ComputeSystem struct {
12
+
13
+	Owner string `json:"Owner,omitempty"`
14
+
15
+	SchemaVersion *Version `json:"SchemaVersion,omitempty"`
16
+
17
+	HostingSystemId string `json:"HostingSystemId,omitempty"`
18
+
19
+	HostedSystem *HostedSystem `json:"HostedSystem,omitempty"`
20
+
21
+	Container *Container `json:"Container,omitempty"`
22
+
23
+	VirtualMachine *VirtualMachine `json:"VirtualMachine,omitempty"`
24
+
25
+	ShouldTerminateOnLastHandleClosed bool `json:"ShouldTerminateOnLastHandleClosed,omitempty"`
26
+}
0 27
new file mode 100644
... ...
@@ -0,0 +1,72 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+import (
12
+	"net/http"
13
+)
14
+
15
+// contextKeys are used to identify the type of value in the context.
16
+// Since these are string, it is possible to get a short description of the
17
+// context key for logging and debugging using key.String().
18
+
19
+type contextKey string
20
+
21
+func (c contextKey) String() string {
22
+	return "auth " + string(c)
23
+}
24
+
25
+var (
26
+	// ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.
27
+	ContextOAuth2    	= contextKey("token")
28
+
29
+	// ContextBasicAuth takes BasicAuth as authentication for the request.
30
+	ContextBasicAuth 	= contextKey("basic")
31
+
32
+	// ContextAccessToken takes a string oauth2 access token as authentication for the request.
33
+	ContextAccessToken 	= contextKey("accesstoken")
34
+
35
+	// ContextAPIKey takes an APIKey as authentication for the request
36
+ 	ContextAPIKey 		= contextKey("apikey")
37
+)
38
+
39
+// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth 
40
+type BasicAuth struct {
41
+	UserName      string            `json:"userName,omitempty"`
42
+	Password      string            `json:"password,omitempty"`	
43
+}
44
+
45
+// APIKey provides API key based authentication to a request passed via context using ContextAPIKey
46
+type APIKey struct {
47
+	Key 	string
48
+	Prefix	string
49
+}
50
+
51
+type Configuration struct {
52
+	BasePath      string            	`json:"basePath,omitempty"`
53
+	Host          string            	`json:"host,omitempty"`
54
+	Scheme        string            	`json:"scheme,omitempty"`
55
+	DefaultHeader map[string]string 	`json:"defaultHeader,omitempty"`
56
+	UserAgent     string            	`json:"userAgent,omitempty"`
57
+	HTTPClient 	  *http.Client
58
+}
59
+
60
+func NewConfiguration() *Configuration {
61
+	cfg := &Configuration{
62
+		BasePath:      "https://localhost",
63
+		DefaultHeader: make(map[string]string),
64
+		UserAgent:     "Swagger-Codegen/2.1.0/go",
65
+	}
66
+	return cfg
67
+}
68
+
69
+func (c *Configuration) AddDefaultHeader(key string, value string) {
70
+	c.DefaultHeader[key] = value
71
+}
0 72
\ No newline at end of file
1 73
new file mode 100644
... ...
@@ -0,0 +1,17 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type ConsoleSize struct {
12
+
13
+	Height int32 `json:"Height,omitempty"`
14
+
15
+	Width int32 `json:"Width,omitempty"`
16
+}
0 17
new file mode 100644
... ...
@@ -0,0 +1,35 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type Container struct {
12
+
13
+	GuestOs *GuestOs `json:"GuestOs,omitempty"`
14
+
15
+	Storage *Storage `json:"Storage,omitempty"`
16
+
17
+	MappedDirectories []MappedDirectory `json:"MappedDirectories,omitempty"`
18
+
19
+	MappedPipes []MappedPipe `json:"MappedPipes,omitempty"`
20
+
21
+	Memory *Memory `json:"Memory,omitempty"`
22
+
23
+	Processor *Processor `json:"Processor,omitempty"`
24
+
25
+	Networking *Networking `json:"Networking,omitempty"`
26
+
27
+	HvSocket *HvSocket `json:"HvSocket,omitempty"`
28
+
29
+	ContainerCredentialGuard *ContainerCredentialGuardState `json:"ContainerCredentialGuard,omitempty"`
30
+
31
+	RegistryChanges *RegistryChanges `json:"RegistryChanges,omitempty"`
32
+
33
+	AssignedDevices []Device `json:"AssignedDevices,omitempty"`
34
+}
0 35
new file mode 100644
... ...
@@ -0,0 +1,25 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type ContainerCredentialGuardState struct {
12
+
13
+	//  Authentication cookie for calls to a Container Credential Guard instance.
14
+	Cookie string `json:"Cookie,omitempty"`
15
+
16
+	//  Name of the RPC endpoint of the Container Credential Guard instance.
17
+	RpcEndpoint string `json:"RpcEndpoint,omitempty"`
18
+
19
+	//  Transport used for the configured Container Credential Guard instance.
20
+	Transport string `json:"Transport,omitempty"`
21
+
22
+	//  Credential spec used for the configured Container Credential Guard instance.
23
+	CredentialSpec string `json:"CredentialSpec,omitempty"`
24
+}
0 25
new file mode 100644
... ...
@@ -0,0 +1,26 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+//  memory usage as viewed from within the container
12
+type ContainerMemoryInformation struct {
13
+
14
+	TotalPhysicalBytes int32 `json:"TotalPhysicalBytes,omitempty"`
15
+
16
+	TotalUsage int32 `json:"TotalUsage,omitempty"`
17
+
18
+	CommittedBytes int32 `json:"CommittedBytes,omitempty"`
19
+
20
+	SharedCommittedBytes int32 `json:"SharedCommittedBytes,omitempty"`
21
+
22
+	CommitLimitBytes int32 `json:"CommitLimitBytes,omitempty"`
23
+
24
+	PeakCommitmentBytes int32 `json:"PeakCommitmentBytes,omitempty"`
25
+}
0 26
new file mode 100644
... ...
@@ -0,0 +1,16 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type Device struct {
12
+
13
+	//  The interface class guid of the device to assign to container.
14
+	InterfaceClassGuid string `json:"InterfaceClassGuid,omitempty"`
15
+}
0 16
new file mode 100644
... ...
@@ -0,0 +1,43 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type Devices struct {
12
+
13
+	ComPorts map[string]ComPort `json:"ComPorts,omitempty"`
14
+
15
+	Scsi map[string]Scsi `json:"Scsi,omitempty"`
16
+
17
+	VirtualPMem *VirtualPMemController `json:"VirtualPMem,omitempty"`
18
+
19
+	NetworkAdapters map[string]NetworkAdapter `json:"NetworkAdapters,omitempty"`
20
+
21
+	VideoMonitor *VideoMonitor `json:"VideoMonitor,omitempty"`
22
+
23
+	Keyboard *Keyboard `json:"Keyboard,omitempty"`
24
+
25
+	Mouse *Mouse `json:"Mouse,omitempty"`
26
+
27
+	HvSocket *HvSocket2 `json:"HvSocket,omitempty"`
28
+
29
+	EnhancedModeVideo *EnhancedModeVideo `json:"EnhancedModeVideo,omitempty"`
30
+
31
+	GuestCrashReporting *GuestCrashReporting `json:"GuestCrashReporting,omitempty"`
32
+
33
+	VirtualSmb *VirtualSmb `json:"VirtualSmb,omitempty"`
34
+
35
+	Plan9 *Plan9 `json:"Plan9,omitempty"`
36
+
37
+	Battery *Battery `json:"Battery,omitempty"`
38
+
39
+	FlexibleIov map[string]FlexibleIoDevice `json:"FlexibleIov,omitempty"`
40
+
41
+	SharedMemory *SharedMemoryConfiguration `json:"SharedMemory,omitempty"`
42
+}
0 43
new file mode 100644
... ...
@@ -0,0 +1,15 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type EnhancedModeVideo struct {
12
+
13
+	ConnectionOptions *RdpConnectionOptions `json:"ConnectionOptions,omitempty"`
14
+}
0 15
new file mode 100644
... ...
@@ -0,0 +1,19 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type FlexibleIoDevice struct {
12
+
13
+	EmulatorId string `json:"EmulatorId,omitempty"`
14
+
15
+	HostingModel string `json:"HostingModel,omitempty"`
16
+
17
+	Configuration []string `json:"Configuration,omitempty"`
18
+}
0 19
new file mode 100644
... ...
@@ -0,0 +1,19 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type GuestConnection struct {
12
+
13
+	//  Use Vsock rather than Hyper-V sockets to communicate with the guest service.
14
+	UseVsock bool `json:"UseVsock,omitempty"`
15
+
16
+	//  Don't disconnect the guest connection when pausing the virtual machine.
17
+	UseConnectedSuspend bool `json:"UseConnectedSuspend,omitempty"`
18
+}
0 19
new file mode 100644
... ...
@@ -0,0 +1,21 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+//  Information about the guest.
12
+type GuestConnectionInfo struct {
13
+
14
+	//  Each schema version x.y stands for the range of versions a.b where a==x  and b<=y. This list comes from the SupportedSchemaVersions field in  GcsCapabilities.
15
+	SupportedSchemaVersions []Version `json:"SupportedSchemaVersions,omitempty"`
16
+
17
+	ProtocolVersion int32 `json:"ProtocolVersion,omitempty"`
18
+
19
+	GuestDefinedCapabilities *interface{} `json:"GuestDefinedCapabilities,omitempty"`
20
+}
0 21
new file mode 100644
... ...
@@ -0,0 +1,15 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type GuestCrashReporting struct {
12
+
13
+	WindowsCrashSettings *WindowsCrashReporting `json:"WindowsCrashSettings,omitempty"`
14
+}
0 15
new file mode 100644
... ...
@@ -0,0 +1,15 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type GuestOs struct {
12
+
13
+	HostName string `json:"HostName,omitempty"`
14
+}
0 15
new file mode 100644
... ...
@@ -0,0 +1,22 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type GuestState struct {
12
+
13
+	//  The path to an existing file uses for persistent guest state storage.  An empty string indicates the system should initialize new transient, in-memory guest state.
14
+	GuestStateFilePath string `json:"GuestStateFilePath,omitempty"`
15
+
16
+	//  The path to an existing file for persistent runtime state storage.  An empty string indicates the system should initialize new transient, in-memory runtime state.
17
+	RuntimeStateFilePath string `json:"RuntimeStateFilePath,omitempty"`
18
+
19
+	//  If true, the guest state and runtime state files will be used as templates  to populate transient, in-memory state instead of using the files as persistent backing store.
20
+	ForceTransientState bool `json:"ForceTransientState,omitempty"`
21
+}
0 22
new file mode 100644
... ...
@@ -0,0 +1,17 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type HostedSystem struct {
12
+
13
+	SchemaVersion *Version `json:"SchemaVersion,omitempty"`
14
+
15
+	Container *Container `json:"Container,omitempty"`
16
+}
0 17
new file mode 100644
... ...
@@ -0,0 +1,17 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type HvSocket struct {
12
+
13
+	Config *HvSocketSystemConfig `json:"Config,omitempty"`
14
+
15
+	EnablePowerShellDirect bool `json:"EnablePowerShellDirect,omitempty"`
16
+}
0 17
new file mode 100644
... ...
@@ -0,0 +1,16 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+//  HvSocket configuration for a VM
12
+type HvSocket2 struct {
13
+
14
+	HvSocketConfig *HvSocketSystemConfig `json:"HvSocketConfig,omitempty"`
15
+}
0 16
new file mode 100644
... ...
@@ -0,0 +1,22 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type HvSocketServiceConfig struct {
12
+
13
+	//  SDDL string that HvSocket will check before allowing a host process to bind  to this specific service.  If not specified, defaults to the system DefaultBindSecurityDescriptor, defined in  HvSocketSystemWpConfig in V1.
14
+	BindSecurityDescriptor string `json:"BindSecurityDescriptor,omitempty"`
15
+
16
+	//  SDDL string that HvSocket will check before allowing a host process to connect  to this specific service.  If not specified, defaults to the system DefaultConnectSecurityDescriptor, defined in  HvSocketSystemWpConfig in V1.
17
+	ConnectSecurityDescriptor string `json:"ConnectSecurityDescriptor,omitempty"`
18
+
19
+	//  If true, HvSocket will process wildcard binds for this service/system combination.  Wildcard binds are secured in the registry at  SOFTWARE/Microsoft/Windows NT/CurrentVersion/Virtualization/HvSocket/WildcardDescriptors
20
+	AllowWildcardBinds bool `json:"AllowWildcardBinds,omitempty"`
21
+}
0 22
new file mode 100644
... ...
@@ -0,0 +1,22 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+//  This is the HCS Schema version of the HvSocket configuration. The VMWP version is  located in Config.Devices.IC in V1.
12
+type HvSocketSystemConfig struct {
13
+
14
+	//  SDDL string that HvSocket will check before allowing a host process to bind  to an unlisted service for this specific container/VM (not wildcard binds).
15
+	DefaultBindSecurityDescriptor string `json:"DefaultBindSecurityDescriptor,omitempty"`
16
+
17
+	//  SDDL string that HvSocket will check before allowing a host process to connect  to an unlisted service in the VM/container.
18
+	DefaultConnectSecurityDescriptor string `json:"DefaultConnectSecurityDescriptor,omitempty"`
19
+
20
+	ServiceTable map[string]HvSocketServiceConfig `json:"ServiceTable,omitempty"`
21
+}
0 22
new file mode 100644
... ...
@@ -0,0 +1,13 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type Keyboard struct {
12
+}
0 13
new file mode 100644
... ...
@@ -0,0 +1,22 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type Layer struct {
12
+
13
+	Id string `json:"Id,omitempty"`
14
+
15
+	Path string `json:"Path,omitempty"`
16
+
17
+	PathType string `json:"PathType,omitempty"`
18
+
19
+	//  Unspecified defaults to Enabled
20
+	Cache string `json:"Cache,omitempty"`
21
+}
0 22
new file mode 100644
... ...
@@ -0,0 +1,21 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type MappedDirectory struct {
12
+
13
+	HostPath string `json:"HostPath,omitempty"`
14
+
15
+	HostPathType string `json:"HostPathType,omitempty"`
16
+
17
+	ContainerPath string `json:"ContainerPath,omitempty"`
18
+
19
+	ReadOnly bool `json:"ReadOnly,omitempty"`
20
+}
0 21
new file mode 100644
... ...
@@ -0,0 +1,19 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type MappedPipe struct {
12
+
13
+	ContainerPipeName string `json:"ContainerPipeName,omitempty"`
14
+
15
+	HostPath string `json:"HostPath,omitempty"`
16
+
17
+	HostPathType string `json:"HostPathType,omitempty"`
18
+}
0 19
new file mode 100644
... ...
@@ -0,0 +1,15 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type Memory struct {
12
+
13
+	SizeInMB int32 `json:"SizeInMB,omitempty"`
14
+}
0 15
new file mode 100644
... ...
@@ -0,0 +1,23 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type Memory2 struct {
12
+
13
+	SizeInMB int32 `json:"SizeInMB,omitempty"`
14
+
15
+	AllowOvercommit bool `json:"AllowOvercommit,omitempty"`
16
+
17
+	EnableHotHint bool `json:"EnableHotHint,omitempty"`
18
+
19
+	EnableColdHint bool `json:"EnableColdHint,omitempty"`
20
+
21
+	EnableEpf bool `json:"EnableEpf,omitempty"`
22
+}
0 23
new file mode 100644
... ...
@@ -0,0 +1,19 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type MemoryInformationForVm struct {
12
+
13
+	VirtualNodeCount int32 `json:"VirtualNodeCount,omitempty"`
14
+
15
+	VirtualMachineMemory *VmMemory `json:"VirtualMachineMemory,omitempty"`
16
+
17
+	VirtualNodes []VirtualNodeInfo `json:"VirtualNodes,omitempty"`
18
+}
0 19
new file mode 100644
... ...
@@ -0,0 +1,20 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+//  Memory runtime statistics
12
+type MemoryStats struct {
13
+
14
+	MemoryUsageCommitBytes int32 `json:"MemoryUsageCommitBytes,omitempty"`
15
+
16
+	MemoryUsageCommitPeakBytes int32 `json:"MemoryUsageCommitPeakBytes,omitempty"`
17
+
18
+	MemoryUsagePrivateWorkingSetBytes int32 `json:"MemoryUsagePrivateWorkingSetBytes,omitempty"`
19
+}
0 20
new file mode 100644
... ...
@@ -0,0 +1,20 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type ModifySettingRequest struct {
12
+	ResourcePath string `json:"ResourcePath,omitempty"`
13
+
14
+	RequestType string `json:"RequestType,omitempty"`
15
+
16
+	Settings interface{} `json:"Settings,omitempty"` // NOTE: Swagger generated as *interface{}. Locally updated
17
+
18
+	GuestRequest interface{} `json:"GuestRequest,omitempty"` // NOTE: Swagger generated as *interface{}. Locally updated
19
+}
0 20
new file mode 100644
... ...
@@ -0,0 +1,13 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type Mouse struct {
12
+}
0 13
new file mode 100644
... ...
@@ -0,0 +1,17 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type NetworkAdapter struct {
12
+
13
+	EndpointId string `json:"EndpointId,omitempty"`
14
+
15
+	MacAddress string `json:"MacAddress,omitempty"`
16
+}
0 17
new file mode 100644
... ...
@@ -0,0 +1,24 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type Networking struct {
12
+
13
+	AllowUnqualifiedDnsQuery bool `json:"AllowUnqualifiedDnsQuery,omitempty"`
14
+
15
+	DnsSearchList string `json:"DnsSearchList,omitempty"`
16
+
17
+	NetworkSharedContainerName string `json:"NetworkSharedContainerName,omitempty"`
18
+
19
+	//  Guid in windows; string in linux
20
+	Namespace string `json:"Namespace,omitempty"`
21
+
22
+	NetworkAdapters []string `json:"NetworkAdapters,omitempty"`
23
+}
0 24
new file mode 100644
... ...
@@ -0,0 +1,16 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+//  Notification data that is indicated to components running in the Virtual Machine.
12
+type PauseNotification struct {
13
+
14
+	Reason string `json:"Reason,omitempty"`
15
+}
0 16
new file mode 100644
... ...
@@ -0,0 +1,18 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+//  Options for HcsPauseComputeSystem
12
+type PauseOptions struct {
13
+
14
+	SuspensionLevel string `json:"SuspensionLevel,omitempty"`
15
+
16
+	HostedNotification *PauseNotification `json:"HostedNotification,omitempty"`
17
+}
0 18
new file mode 100644
... ...
@@ -0,0 +1,15 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type Plan9 struct {
12
+
13
+	Shares []Plan9Share `json:"Shares,omitempty"`
14
+}
0 15
new file mode 100644
... ...
@@ -0,0 +1,26 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type Plan9Share struct {
12
+
13
+	Name string `json:"Name,omitempty"`
14
+
15
+	//  The name by which the guest operation system can access this share, via  the aname parameter in the Plan9 protocol.
16
+	AccessName string `json:"AccessName,omitempty"`
17
+
18
+	Path string `json:"Path,omitempty"`
19
+
20
+	Port int32 `json:"Port,omitempty"`
21
+
22
+	ReadOnly bool `json:"ReadOnly,omitempty"`
23
+
24
+	UseShareRootIdentity bool `json:"UseShareRootIdentity,omitempty"`
25
+}
0 26
new file mode 100644
... ...
@@ -0,0 +1,34 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+import (
12
+	"time"
13
+)
14
+
15
+//  Information about a process running in a container
16
+type ProcessDetails struct {
17
+
18
+	ProcessId int32 `json:"ProcessId,omitempty"`
19
+
20
+	ImageName string `json:"ImageName,omitempty"`
21
+
22
+	CreateTimestamp time.Time `json:"CreateTimestamp,omitempty"`
23
+
24
+	UserTime100ns int32 `json:"UserTime100ns,omitempty"`
25
+
26
+	KernelTime100ns int32 `json:"KernelTime100ns,omitempty"`
27
+
28
+	MemoryCommitBytes int32 `json:"MemoryCommitBytes,omitempty"`
29
+
30
+	MemoryWorkingSetPrivateBytes int32 `json:"MemoryWorkingSetPrivateBytes,omitempty"`
31
+
32
+	MemoryWorkingSetSharedBytes int32 `json:"MemoryWorkingSetSharedBytes,omitempty"`
33
+}
0 34
new file mode 100644
... ...
@@ -0,0 +1,20 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+//  Passed to HcsRpc_ModifyProcess
12
+type ProcessModifyRequest struct {
13
+
14
+	Operation string `json:"Operation,omitempty"`
15
+
16
+	ConsoleSize *ConsoleSize `json:"ConsoleSize,omitempty"`
17
+
18
+	CloseHandle *CloseHandle `json:"CloseHandle,omitempty"`
19
+}
0 20
new file mode 100644
... ...
@@ -0,0 +1,47 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type ProcessParameters struct {
12
+
13
+	ApplicationName string `json:"ApplicationName,omitempty"`
14
+
15
+	CommandLine string `json:"CommandLine,omitempty"`
16
+
17
+	//  optional alternative to CommandLine, currently only supported by Linux GCS
18
+	CommandArgs []string `json:"CommandArgs,omitempty"`
19
+
20
+	User string `json:"User,omitempty"`
21
+
22
+	WorkingDirectory string `json:"WorkingDirectory,omitempty"`
23
+
24
+	Environment map[string]string `json:"Environment,omitempty"`
25
+
26
+	//  if set, will run as low-privilege process
27
+	RestrictedToken bool `json:"RestrictedToken,omitempty"`
28
+
29
+	//  if set, ignore StdErrPipe
30
+	EmulateConsole bool `json:"EmulateConsole,omitempty"`
31
+
32
+	CreateStdInPipe bool `json:"CreateStdInPipe,omitempty"`
33
+
34
+	CreateStdOutPipe bool `json:"CreateStdOutPipe,omitempty"`
35
+
36
+	CreateStdErrPipe bool `json:"CreateStdErrPipe,omitempty"`
37
+
38
+	//  height then width
39
+	ConsoleSize []int32 `json:"ConsoleSize,omitempty"`
40
+
41
+	//  if set, find an existing session for the user and create the process in it
42
+	UseExistingLogin bool `json:"UseExistingLogin,omitempty"`
43
+
44
+	//  if set, use the legacy console instead of conhost
45
+	UseLegacyConsole bool `json:"UseLegacyConsole,omitempty"`
46
+}
0 47
new file mode 100644
... ...
@@ -0,0 +1,22 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+//  Status of a process running in a container
12
+type ProcessStatus struct {
13
+
14
+	ProcessId int32 `json:"ProcessId,omitempty"`
15
+
16
+	Exited bool `json:"Exited,omitempty"`
17
+
18
+	ExitCode int32 `json:"ExitCode,omitempty"`
19
+
20
+	LastWaitResult int32 `json:"LastWaitResult,omitempty"`
21
+}
0 22
new file mode 100644
... ...
@@ -0,0 +1,19 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type Processor struct {
12
+
13
+	Count int32 `json:"Count,omitempty"`
14
+
15
+	Maximum int32 `json:"Maximum,omitempty"`
16
+
17
+	Weight int32 `json:"Weight,omitempty"`
18
+}
0 19
new file mode 100644
... ...
@@ -0,0 +1,21 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type Processor2 struct {
12
+
13
+	Count int32 `json:"Count,omitempty"`
14
+
15
+	Limit int32 `json:"Limit,omitempty"`
16
+
17
+	Weight int32 `json:"Weight,omitempty"`
18
+
19
+	ExposeVirtualizationExtensions bool `json:"ExposeVirtualizationExtensions,omitempty"`
20
+}
0 21
new file mode 100644
... ...
@@ -0,0 +1,20 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+//  CPU runtime statistics
12
+type ProcessorStats struct {
13
+
14
+	TotalRuntime100ns int32 `json:"TotalRuntime100ns,omitempty"`
15
+
16
+	RuntimeUser100ns int32 `json:"RuntimeUser100ns,omitempty"`
17
+
18
+	RuntimeKernel100ns int32 `json:"RuntimeKernel100ns,omitempty"`
19
+}
0 20
new file mode 100644
... ...
@@ -0,0 +1,47 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type Properties struct {
12
+
13
+	Id string `json:"Id,omitempty"`
14
+
15
+	SystemType string `json:"SystemType,omitempty"`
16
+
17
+	RuntimeOsType string `json:"RuntimeOsType,omitempty"`
18
+
19
+	Name string `json:"Name,omitempty"`
20
+
21
+	Owner string `json:"Owner,omitempty"`
22
+
23
+	RuntimeId string `json:"RuntimeId,omitempty"`
24
+
25
+	RuntimeTemplateId string `json:"RuntimeTemplateId,omitempty"`
26
+
27
+	State string `json:"State,omitempty"`
28
+
29
+	Stopped bool `json:"Stopped,omitempty"`
30
+
31
+	ExitType string `json:"ExitType,omitempty"`
32
+
33
+	Memory *MemoryInformationForVm `json:"Memory,omitempty"`
34
+
35
+	Statistics *Statistics `json:"Statistics,omitempty"`
36
+
37
+	ProcessList []ProcessDetails `json:"ProcessList,omitempty"`
38
+
39
+	TerminateOnLastHandleClosed bool `json:"TerminateOnLastHandleClosed,omitempty"`
40
+
41
+	HostingSystemId string `json:"HostingSystemId,omitempty"`
42
+
43
+	SharedMemoryRegionInfo []SharedMemoryRegionInfo `json:"SharedMemoryRegionInfo,omitempty"`
44
+
45
+	GuestConnectionInfo *GuestConnectionInfo `json:"GuestConnectionInfo,omitempty"`
46
+}
0 47
new file mode 100644
... ...
@@ -0,0 +1,16 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+//   By default the basic properties will be returned. This query provides a way to  request specific properties. 
12
+type PropertyQuery struct {
13
+
14
+	PropertyTypes []string `json:"PropertyTypes,omitempty"`
15
+}
0 16
new file mode 100644
... ...
@@ -0,0 +1,17 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type RdpConnectionOptions struct {
12
+
13
+	AccessSids []string `json:"AccessSids,omitempty"`
14
+
15
+	NamedPipe string `json:"NamedPipe,omitempty"`
16
+}
0 17
new file mode 100644
... ...
@@ -0,0 +1,17 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type RegistryChanges struct {
12
+
13
+	AddValues []RegistryValue `json:"AddValues,omitempty"`
14
+
15
+	DeleteKeys []RegistryKey `json:"DeleteKeys,omitempty"`
16
+}
0 17
new file mode 100644
... ...
@@ -0,0 +1,19 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type RegistryKey struct {
12
+
13
+	Hive string `json:"Hive,omitempty"`
14
+
15
+	Name string `json:"Name,omitempty"`
16
+
17
+	Volatile bool `json:"Volatile,omitempty"`
18
+}
0 19
new file mode 100644
... ...
@@ -0,0 +1,31 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type RegistryValue struct {
12
+
13
+	Key *RegistryKey `json:"Key,omitempty"`
14
+
15
+	Name string `json:"Name,omitempty"`
16
+
17
+	Type_ string `json:"Type,omitempty"`
18
+
19
+	//  One and only one value type must be set.
20
+	StringValue string `json:"StringValue,omitempty"`
21
+
22
+	BinaryValue string `json:"BinaryValue,omitempty"`
23
+
24
+	DWordValue int32 `json:"DWordValue,omitempty"`
25
+
26
+	QWordValue int32 `json:"QWordValue,omitempty"`
27
+
28
+	//  Only used if RegistryValueType is CustomType  The data is in BinaryValue
29
+	CustomType int32 `json:"CustomType,omitempty"`
30
+}
0 31
new file mode 100644
... ...
@@ -0,0 +1,19 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type RestoreState struct {
12
+
13
+	//  The path to the save state file to restore the system from.
14
+	SaveStateFilePath string `json:"SaveStateFilePath,omitempty"`
15
+
16
+	//  The ID of the template system to clone this new system off of. An empty  string indicates the system should not be cloned from a template.
17
+	TemplateSystemId string `json:"TemplateSystemId,omitempty"`
18
+}
0 19
new file mode 100644
... ...
@@ -0,0 +1,19 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type SaveOptions struct {
12
+
13
+	//  The type of save operation to be performed.
14
+	SaveType string `json:"SaveType,omitempty"`
15
+
16
+	//  The path to the file that will container the saved state.
17
+	SaveStateFilePath string `json:"SaveStateFilePath,omitempty"`
18
+}
0 19
new file mode 100644
... ...
@@ -0,0 +1,16 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type Scsi struct {
12
+
13
+	//  Map of attachments, where the key is the integer LUN number on the controller.
14
+	Attachments map[string]Attachment `json:"Attachments,omitempty"`
15
+}
0 16
new file mode 100644
... ...
@@ -0,0 +1,15 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type SharedMemoryConfiguration struct {
12
+
13
+	Regions []SharedMemoryRegion `json:"Regions,omitempty"`
14
+}
0 15
new file mode 100644
... ...
@@ -0,0 +1,23 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type SharedMemoryRegion struct {
12
+
13
+	SectionName string `json:"SectionName,omitempty"`
14
+
15
+	StartOffset int32 `json:"StartOffset,omitempty"`
16
+
17
+	Length int32 `json:"Length,omitempty"`
18
+
19
+	AllowGuestWrite bool `json:"AllowGuestWrite,omitempty"`
20
+
21
+	HiddenFromGuest bool `json:"HiddenFromGuest,omitempty"`
22
+}
0 23
new file mode 100644
... ...
@@ -0,0 +1,17 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type SharedMemoryRegionInfo struct {
12
+
13
+	SectionName string `json:"SectionName,omitempty"`
14
+
15
+	GuestPhysicalAddress int32 `json:"GuestPhysicalAddress,omitempty"`
16
+}
0 17
new file mode 100644
... ...
@@ -0,0 +1,18 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+//  Silo job information
12
+type SiloProperties struct {
13
+
14
+	Enabled bool `json:"Enabled,omitempty"`
15
+
16
+	JobName string `json:"JobName,omitempty"`
17
+}
0 18
new file mode 100644
... ...
@@ -0,0 +1,30 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+import (
12
+	"time"
13
+)
14
+
15
+//  Runtime statistics for a container
16
+type Statistics struct {
17
+
18
+	Timestamp time.Time `json:"Timestamp,omitempty"`
19
+
20
+	ContainerStartTime time.Time `json:"ContainerStartTime,omitempty"`
21
+
22
+	Uptime100ns int32 `json:"Uptime100ns,omitempty"`
23
+
24
+	Processor *ProcessorStats `json:"Processor,omitempty"`
25
+
26
+	Memory *MemoryStats `json:"Memory,omitempty"`
27
+
28
+	Storage *StorageStats `json:"Storage,omitempty"`
29
+}
0 30
new file mode 100644
... ...
@@ -0,0 +1,21 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type Storage struct {
12
+
13
+	//  List of layers that describe the parent hierarchy for a container's  storage. These layers combined together, presented as a disposable  and/or committable working storage, are used by the container to  record all changes done to the parent layers.
14
+	Layers []Layer `json:"Layers,omitempty"`
15
+
16
+	//  Path that points to the scratch space of a container, where parent  layers are combined together to present a new disposable and/or committable  layer with the changes done during its runtime.
17
+	Path string `json:"Path,omitempty"`
18
+
19
+	QoS *StorageQoS `json:"QoS,omitempty"`
20
+}
0 21
new file mode 100644
... ...
@@ -0,0 +1,17 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type StorageQoS struct {
12
+
13
+	IopsMaximum int32 `json:"IopsMaximum,omitempty"`
14
+
15
+	BandwidthMaximum int32 `json:"BandwidthMaximum,omitempty"`
16
+}
0 17
new file mode 100644
... ...
@@ -0,0 +1,22 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+//  Storage runtime statistics
12
+type StorageStats struct {
13
+
14
+	ReadCountNormalized int32 `json:"ReadCountNormalized,omitempty"`
15
+
16
+	ReadSizeBytes int32 `json:"ReadSizeBytes,omitempty"`
17
+
18
+	WriteCountNormalized int32 `json:"WriteCountNormalized,omitempty"`
19
+
20
+	WriteSizeBytes int32 `json:"WriteSizeBytes,omitempty"`
21
+}
0 22
new file mode 100644
... ...
@@ -0,0 +1,17 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type Topology struct {
12
+
13
+	Memory *Memory2 `json:"Memory,omitempty"`
14
+
15
+	Processor *Processor2 `json:"Processor,omitempty"`
16
+}
0 17
new file mode 100644
... ...
@@ -0,0 +1,21 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type Uefi struct {
12
+
13
+	EnableDebugger bool `json:"EnableDebugger,omitempty"`
14
+
15
+	SecureBootTemplateId string `json:"SecureBootTemplateId,omitempty"`
16
+
17
+	BootThis *UefiBootEntry `json:"BootThis,omitempty"`
18
+
19
+	Console string `json:"Console,omitempty"`
20
+}
0 21
new file mode 100644
... ...
@@ -0,0 +1,23 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type UefiBootEntry struct {
12
+
13
+	DeviceType string `json:"DeviceType,omitempty"`
14
+
15
+	DevicePath string `json:"DevicePath,omitempty"`
16
+
17
+	DiskNumber int32 `json:"DiskNumber,omitempty"`
18
+
19
+	OptionalData string `json:"OptionalData,omitempty"`
20
+
21
+	VmbFsRootPath string `json:"VmbFsRootPath,omitempty"`
22
+}
0 23
new file mode 100644
... ...
@@ -0,0 +1,17 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type Version struct {
12
+
13
+	Major int32 `json:"Major,omitempty"`
14
+
15
+	Minor int32 `json:"Minor,omitempty"`
16
+}
0 17
new file mode 100644
... ...
@@ -0,0 +1,19 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type VideoMonitor struct {
12
+
13
+	HorizontalResolution int32 `json:"HorizontalResolution,omitempty"`
14
+
15
+	VerticalResolution int32 `json:"VerticalResolution,omitempty"`
16
+
17
+	ConnectionOptions *RdpConnectionOptions `json:"ConnectionOptions,omitempty"`
18
+}
0 19
new file mode 100644
... ...
@@ -0,0 +1,29 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type VirtualMachine struct {
12
+
13
+	Chipset *Chipset `json:"Chipset,omitempty"`
14
+
15
+	ComputeTopology *Topology `json:"ComputeTopology,omitempty"`
16
+
17
+	Devices *Devices `json:"Devices,omitempty"`
18
+
19
+	GuestState *GuestState `json:"GuestState,omitempty"`
20
+
21
+	RestoreState *RestoreState `json:"RestoreState,omitempty"`
22
+
23
+	RegistryChanges *RegistryChanges `json:"RegistryChanges,omitempty"`
24
+
25
+	StorageQoS *StorageQoS `json:"StorageQoS,omitempty"`
26
+
27
+	GuestConnection *GuestConnection `json:"GuestConnection,omitempty"`
28
+}
0 29
new file mode 100644
... ...
@@ -0,0 +1,21 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type VirtualNodeInfo struct {
12
+
13
+	VirtualNodeIndex int32 `json:"VirtualNodeIndex,omitempty"`
14
+
15
+	PhysicalNodeNumber int32 `json:"PhysicalNodeNumber,omitempty"`
16
+
17
+	VirtualProcessorCount int32 `json:"VirtualProcessorCount,omitempty"`
18
+
19
+	MemoryUsageInPages int32 `json:"MemoryUsageInPages,omitempty"`
20
+}
0 21
new file mode 100644
... ...
@@ -0,0 +1,21 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type VirtualPMemController struct {
12
+
13
+	Devices map[string]VirtualPMemDevice `json:"Devices,omitempty"`
14
+
15
+	MaximumCount int32 `json:"MaximumCount,omitempty"`
16
+
17
+	MaximumSizeBytes int32 `json:"MaximumSizeBytes,omitempty"`
18
+
19
+	Backing string `json:"Backing,omitempty"`
20
+}
0 21
new file mode 100644
... ...
@@ -0,0 +1,19 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type VirtualPMemDevice struct {
12
+
13
+	HostPath string `json:"HostPath,omitempty"`
14
+
15
+	ReadOnly bool `json:"ReadOnly,omitempty"`
16
+
17
+	ImageFormat string `json:"ImageFormat,omitempty"`
18
+}
0 19
new file mode 100644
... ...
@@ -0,0 +1,17 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type VirtualSmb struct {
12
+
13
+	Shares []VirtualSmbShare `json:"Shares,omitempty"`
14
+
15
+	DirectFileMappingInMB int64 `json:"DirectFileMappingInMB,omitempty"`
16
+}
0 17
new file mode 100644
... ...
@@ -0,0 +1,21 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type VirtualSmbShare struct {
12
+
13
+	Name string `json:"Name,omitempty"`
14
+
15
+	Path string `json:"Path,omitempty"`
16
+
17
+	AllowedFiles []string `json:"AllowedFiles,omitempty"`
18
+
19
+	Options *VirtualSmbShareOptions `json:"Options,omitempty"`
20
+}
0 21
new file mode 100644
... ...
@@ -0,0 +1,63 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type VirtualSmbShareOptions struct {
12
+
13
+	ReadOnly bool `json:"ReadOnly,omitempty"`
14
+
15
+	//  convert exclusive access to shared read access
16
+	ShareRead bool `json:"ShareRead,omitempty"`
17
+
18
+	//  all opens will use cached I/O
19
+	CacheIo bool `json:"CacheIo,omitempty"`
20
+
21
+	//  disable oplock support
22
+	NoOplocks bool `json:"NoOplocks,omitempty"`
23
+
24
+	//  Acquire the backup privilege when attempting to open
25
+	TakeBackupPrivilege bool `json:"TakeBackupPrivilege,omitempty"`
26
+
27
+	//  Use the identity of the share root when opening
28
+	UseShareRootIdentity bool `json:"UseShareRootIdentity,omitempty"`
29
+
30
+	//  disable Direct Mapping
31
+	NoDirectmap bool `json:"NoDirectmap,omitempty"`
32
+
33
+	//  disable Byterange locks
34
+	NoLocks bool `json:"NoLocks,omitempty"`
35
+
36
+	//  disable Directory CHange Notifications
37
+	NoDirnotify bool `json:"NoDirnotify,omitempty"`
38
+
39
+	//  share is use for VM shared memory
40
+	VmSharedMemory bool `json:"VmSharedMemory,omitempty"`
41
+
42
+	//  allow access only to the files specified in AllowedFiles
43
+	RestrictFileAccess bool `json:"RestrictFileAccess,omitempty"`
44
+
45
+	//  disable all oplocks except Level II
46
+	ForceLevelIIOplocks bool `json:"ForceLevelIIOplocks,omitempty"`
47
+
48
+	//  Allow the host to reparse this base layer
49
+	ReparseBaseLayer bool `json:"ReparseBaseLayer,omitempty"`
50
+
51
+	//  Enable pseudo-oplocks
52
+	PseudoOplocks bool `json:"PseudoOplocks,omitempty"`
53
+
54
+	//  All opens will use non-cached IO
55
+	NonCacheIo bool `json:"NonCacheIo,omitempty"`
56
+
57
+	//  Enable pseudo directory change notifications
58
+	PseudoDirnotify bool `json:"PseudoDirnotify,omitempty"`
59
+
60
+	//  Block directory enumeration, renames, and deletes.
61
+	SingleFileMapping bool `json:"SingleFileMapping,omitempty"`
62
+}
0 63
new file mode 100644
... ...
@@ -0,0 +1,27 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type VmMemory struct {
12
+
13
+	AvailableMemory int32 `json:"AvailableMemory,omitempty"`
14
+
15
+	AvailableMemoryBuffer int32 `json:"AvailableMemoryBuffer,omitempty"`
16
+
17
+	ReservedMemory int32 `json:"ReservedMemory,omitempty"`
18
+
19
+	AssignedMemory int32 `json:"AssignedMemory,omitempty"`
20
+
21
+	SlpActive bool `json:"SlpActive,omitempty"`
22
+
23
+	BalancingEnabled bool `json:"BalancingEnabled,omitempty"`
24
+
25
+	DmOperationInProgress bool `json:"DmOperationInProgress,omitempty"`
26
+}
0 27
new file mode 100644
... ...
@@ -0,0 +1,17 @@
0
+/*
1
+ * HCS API
2
+ *
3
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ *
5
+ * API version: 2.1
6
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
7
+ */
8
+
9
+package hcsschema
10
+
11
+type WindowsCrashReporting struct {
12
+
13
+	DumpFileName string `json:"DumpFileName,omitempty"`
14
+
15
+	MaxDumpSize int64 `json:"MaxDumpSize,omitempty"`
16
+}
... ...
@@ -19,6 +19,7 @@ func ActivateLayer(info DriverInfo, id string) error {
19 19
 func CreateLayer(info DriverInfo, id, parent string) error {
20 20
 	return wclayer.CreateLayer(layerPath(&info, id), parent)
21 21
 }
22
+
22 23
 // New clients should use CreateScratchLayer instead. Kept in to preserve API compatibility.
23 24
 func CreateSandboxLayer(info DriverInfo, layerId, parentId string, parentLayerPaths []string) error {
24 25
 	return wclayer.CreateScratchLayer(layerPath(&info, layerId), parentLayerPaths)
... ...
@@ -32,6 +33,7 @@ func DeactivateLayer(info DriverInfo, id string) error {
32 32
 func DestroyLayer(info DriverInfo, id string) error {
33 33
 	return wclayer.DestroyLayer(layerPath(&info, id))
34 34
 }
35
+
35 36
 // New clients should use ExpandScratchSize instead. Kept in to preserve API compatibility.
36 37
 func ExpandSandboxSize(info DriverInfo, layerId string, size uint64) error {
37 38
 	return wclayer.ExpandScratchSize(layerPath(&info, layerId), size)
... ...
@@ -1,4 +1,4 @@
1
-![banner](https://github.com/containerd/containerd.io/blob/master/static/img/containerd-dark.png?raw=true)
1
+![containerd banner](https://raw.githubusercontent.com/cncf/artwork/master/containerd/horizontal/color/containerd-horizontal-color.png)
2 2
 
3 3
 [![GoDoc](https://godoc.org/github.com/containerd/containerd?status.svg)](https://godoc.org/github.com/containerd/containerd)
4 4
 [![Build Status](https://travis-ci.org/containerd/containerd.svg?branch=master)](https://travis-ci.org/containerd/containerd)
... ...
@@ -236,3 +236,16 @@ The containerd codebase is released under the [Apache 2.0 license](LICENSE.code)
236 236
 The README.md file, and files in the "docs" folder are licensed under the
237 237
 Creative Commons Attribution 4.0 International License. You may obtain a
238 238
 copy of the license, titled CC-BY-4.0, at http://creativecommons.org/licenses/by/4.0/.
239
+
240
+## Project details
241
+
242
+**containerd** is the primary open source project within the broader containerd GitHub repository.
243
+However, all projects within the repo have common maintainership, governance, and contributing
244
+guidelines which are stored in a `project` repository commonly for all containerd projects.
245
+
246
+Please find all these core project documents, including the:
247
+ * [Project governance](https://github.com/containerd/project/blob/master/GOVERNANCE.md),
248
+ * [Maintainers](https://github.com/containerd/project/blob/master/MAINTAINERS),
249
+ * and [Contributing guidelines](https://github.com/containerd/project/blob/master/CONTRIBUTING.md)
250
+
251
+information in our [`containerd/project`](https://github.com/containerd/project) repository.
... ...
@@ -1,4 +1,4 @@
1
-// +build linux freebsd solaris
1
+// +build freebsd linux openbsd solaris
2 2
 
3 3
 /*
4 4
    Copyright The containerd Authors.
... ...
@@ -110,8 +110,9 @@ type IngestManager interface {
110 110
 
111 111
 // Writer handles the write of content into a content store
112 112
 type Writer interface {
113
-	// Close is expected to be called after Commit() when commission is needed.
114
-	// Closing a writer without commit allows resuming or aborting.
113
+	// Close closes the writer, if the writer has not been
114
+	// committed this allows resuming or aborting.
115
+	// Calling Close on a closed writer will not error.
115 116
 	io.WriteCloser
116 117
 
117 118
 	// Digest may return empty digest or panics until committed.
... ...
@@ -119,6 +120,8 @@ type Writer interface {
119 119
 
120 120
 	// Commit commits the blob (but no roll-back is guaranteed on an error).
121 121
 	// size and expected can be zero-value when unknown.
122
+	// Commit always closes the writer, even on error.
123
+	// ErrAlreadyExists aborts the writer.
122 124
 	Commit(ctx context.Context, size int64, expected digest.Digest, opts ...Opt) error
123 125
 
124 126
 	// Status returns the current state of write
... ...
@@ -524,12 +524,11 @@ func (s *store) writer(ctx context.Context, ref string, total int64, expected di
524 524
 		if err != nil {
525 525
 			return nil, err
526 526
 		}
527
-		defer fp.Close()
528 527
 
529 528
 		p := bufPool.Get().(*[]byte)
530
-		defer bufPool.Put(p)
531
-
532 529
 		offset, err = io.CopyBuffer(digester.Hash(), fp, *p)
530
+		bufPool.Put(p)
531
+		fp.Close()
533 532
 		if err != nil {
534 533
 			return nil, err
535 534
 		}
... ...
@@ -26,6 +26,7 @@ import (
26 26
 
27 27
 	"github.com/containerd/containerd/content"
28 28
 	"github.com/containerd/containerd/errdefs"
29
+	"github.com/containerd/containerd/log"
29 30
 	"github.com/opencontainers/go-digest"
30 31
 	"github.com/pkg/errors"
31 32
 )
... ...
@@ -80,43 +81,36 @@ func (w *writer) Commit(ctx context.Context, size int64, expected digest.Digest,
80 80
 		}
81 81
 	}
82 82
 
83
-	if w.fp == nil {
83
+	// Ensure even on error the writer is fully closed
84
+	defer unlock(w.ref)
85
+	fp := w.fp
86
+	w.fp = nil
87
+
88
+	if fp == nil {
84 89
 		return errors.Wrap(errdefs.ErrFailedPrecondition, "cannot commit on closed writer")
85 90
 	}
86 91
 
87
-	if err := w.fp.Sync(); err != nil {
92
+	if err := fp.Sync(); err != nil {
93
+		fp.Close()
88 94
 		return errors.Wrap(err, "sync failed")
89 95
 	}
90 96
 
91
-	fi, err := w.fp.Stat()
97
+	fi, err := fp.Stat()
98
+	closeErr := fp.Close()
92 99
 	if err != nil {
93 100
 		return errors.Wrap(err, "stat on ingest file failed")
94 101
 	}
95
-
96
-	// change to readonly, more important for read, but provides _some_
97
-	// protection from this point on. We use the existing perms with a mask
98
-	// only allowing reads honoring the umask on creation.
99
-	//
100
-	// This removes write and exec, only allowing read per the creation umask.
101
-	//
102
-	// NOTE: Windows does not support this operation
103
-	if runtime.GOOS != "windows" {
104
-		if err := w.fp.Chmod((fi.Mode() & os.ModePerm) &^ 0333); err != nil {
105
-			return errors.Wrap(err, "failed to change ingest file permissions")
106
-		}
102
+	if closeErr != nil {
103
+		return errors.Wrap(err, "failed to close ingest file")
107 104
 	}
108 105
 
109 106
 	if size > 0 && size != fi.Size() {
110
-		return errors.Errorf("unexpected commit size %d, expected %d", fi.Size(), size)
111
-	}
112
-
113
-	if err := w.fp.Close(); err != nil {
114
-		return errors.Wrap(err, "failed closing ingest")
107
+		return errors.Wrapf(errdefs.ErrFailedPrecondition, "unexpected commit size %d, expected %d", fi.Size(), size)
115 108
 	}
116 109
 
117 110
 	dgst := w.digester.Digest()
118 111
 	if expected != "" && expected != dgst {
119
-		return errors.Errorf("unexpected commit digest %s, expected %s", dgst, expected)
112
+		return errors.Wrapf(errdefs.ErrFailedPrecondition, "unexpected commit digest %s, expected %s", dgst, expected)
120 113
 	}
121 114
 
122 115
 	var (
... ...
@@ -129,27 +123,48 @@ func (w *writer) Commit(ctx context.Context, size int64, expected digest.Digest,
129 129
 		return err
130 130
 	}
131 131
 
132
-	// clean up!!
133
-	defer os.RemoveAll(w.path)
134
-
135 132
 	if _, err := os.Stat(target); err == nil {
136 133
 		// collision with the target file!
134
+		if err := os.RemoveAll(w.path); err != nil {
135
+			log.G(ctx).WithField("ref", w.ref).WithField("path", w.path).Errorf("failed to remove ingest directory")
136
+		}
137 137
 		return errors.Wrapf(errdefs.ErrAlreadyExists, "content %v", dgst)
138 138
 	}
139
+
139 140
 	if err := os.Rename(ingest, target); err != nil {
140 141
 		return err
141 142
 	}
143
+
144
+	// Ingest has now been made available in the content store, attempt to complete
145
+	// setting metadata but errors should only be logged and not returned since
146
+	// the content store cannot be cleanly rolled back.
147
+
142 148
 	commitTime := time.Now()
143 149
 	if err := os.Chtimes(target, commitTime, commitTime); err != nil {
144
-		return err
150
+		log.G(ctx).WithField("digest", dgst).Errorf("failed to change file time to commit time")
145 151
 	}
146 152
 
147
-	w.fp = nil
148
-	unlock(w.ref)
153
+	// clean up!!
154
+	if err := os.RemoveAll(w.path); err != nil {
155
+		log.G(ctx).WithField("ref", w.ref).WithField("path", w.path).Errorf("failed to remove ingest directory")
156
+	}
149 157
 
150 158
 	if w.s.ls != nil && base.Labels != nil {
151 159
 		if err := w.s.ls.Set(dgst, base.Labels); err != nil {
152
-			return err
160
+			log.G(ctx).WithField("digest", dgst).Errorf("failed to set labels")
161
+		}
162
+	}
163
+
164
+	// change to readonly, more important for read, but provides _some_
165
+	// protection from this point on. We use the existing perms with a mask
166
+	// only allowing reads honoring the umask on creation.
167
+	//
168
+	// This removes write and exec, only allowing read per the creation umask.
169
+	//
170
+	// NOTE: Windows does not support this operation
171
+	if runtime.GOOS != "windows" {
172
+		if err := os.Chmod(target, (fi.Mode()&os.ModePerm)&^0333); err != nil {
173
+			log.G(ctx).WithField("ref", w.ref).Errorf("failed to make readonly")
153 174
 		}
154 175
 	}
155 176
 
... ...
@@ -110,6 +110,9 @@ func (e *eventRemote) Subscribe(ctx context.Context, filters ...string) (ch <-ch
110 110
 				Event:     ev.Event,
111 111
 			}:
112 112
 			case <-ctx.Done():
113
+				if cerr := ctx.Err(); cerr != context.Canceled {
114
+					errq <- cerr
115
+				}
113 116
 				return
114 117
 			}
115 118
 		}
... ...
@@ -36,7 +36,7 @@ import (
36 36
 	"github.com/pkg/errors"
37 37
 )
38 38
 
39
-// ImportIndex imports an index from a tar achive image bundle
39
+// ImportIndex imports an index from a tar archive image bundle
40 40
 // - implements Docker v1.1, v1.2 and OCI v1.
41 41
 // - prefers OCI v1 when provided
42 42
 // - creates OCI index for Docker formats
... ...
@@ -164,7 +164,7 @@ func ImportIndex(ctx context.Context, store content.Store, reader io.Reader) (oc
164 164
 		if len(platforms) > 0 {
165 165
 			// Only one platform can be resolved from non-index manifest,
166 166
 			// The platform can only come from the config included above,
167
-			// if the config has no platform it can be safely ommitted.
167
+			// if the config has no platform it can be safely omitted.
168 168
 			desc.Platform = &platforms[0]
169 169
 		}
170 170
 
... ...
@@ -556,12 +556,6 @@ func (nw *namespacedWriter) Commit(ctx context.Context, size int64, expected dig
556 556
 	var innerErr error
557 557
 
558 558
 	if err := update(ctx, nw.db, func(tx *bolt.Tx) error {
559
-		bkt := getIngestsBucket(tx, nw.namespace)
560
-		if bkt != nil {
561
-			if err := bkt.DeleteBucket([]byte(nw.ref)); err != nil && err != bolt.ErrBucketNotFound {
562
-				return err
563
-			}
564
-		}
565 559
 		dgst, err := nw.commit(ctx, tx, size, expected, opts...)
566 560
 		if err != nil {
567 561
 			if !errdefs.IsAlreadyExists(err) {
... ...
@@ -569,6 +563,12 @@ func (nw *namespacedWriter) Commit(ctx context.Context, size int64, expected dig
569 569
 			}
570 570
 			innerErr = err
571 571
 		}
572
+		bkt := getIngestsBucket(tx, nw.namespace)
573
+		if bkt != nil {
574
+			if err := bkt.DeleteBucket([]byte(nw.ref)); err != nil && err != bolt.ErrBucketNotFound {
575
+				return err
576
+			}
577
+		}
572 578
 		if err := removeIngestLease(ctx, tx, nw.ref); err != nil {
573 579
 			return err
574 580
 		}
... ...
@@ -584,30 +584,38 @@ func (nw *namespacedWriter) commit(ctx context.Context, tx *bolt.Tx, size int64,
584 584
 	var base content.Info
585 585
 	for _, opt := range opts {
586 586
 		if err := opt(&base); err != nil {
587
+			if nw.w != nil {
588
+				nw.w.Close()
589
+			}
587 590
 			return "", err
588 591
 		}
589 592
 	}
590 593
 	if err := validateInfo(&base); err != nil {
594
+		if nw.w != nil {
595
+			nw.w.Close()
596
+		}
591 597
 		return "", err
592 598
 	}
593 599
 
594 600
 	var actual digest.Digest
595 601
 	if nw.w == nil {
596 602
 		if size != 0 && size != nw.desc.Size {
597
-			return "", errors.Errorf("%q failed size validation: %v != %v", nw.ref, nw.desc.Size, size)
603
+			return "", errors.Wrapf(errdefs.ErrFailedPrecondition, "%q failed size validation: %v != %v", nw.ref, nw.desc.Size, size)
598 604
 		}
599 605
 		if expected != "" && expected != nw.desc.Digest {
600
-			return "", errors.Errorf("%q unexpected digest", nw.ref)
606
+			return "", errors.Wrapf(errdefs.ErrFailedPrecondition, "%q unexpected digest", nw.ref)
601 607
 		}
602 608
 		size = nw.desc.Size
603 609
 		actual = nw.desc.Digest
604 610
 	} else {
605 611
 		status, err := nw.w.Status()
606 612
 		if err != nil {
613
+			nw.w.Close()
607 614
 			return "", err
608 615
 		}
609 616
 		if size != 0 && size != status.Offset {
610
-			return "", errors.Errorf("%q failed size validation: %v != %v", nw.ref, status.Offset, size)
617
+			nw.w.Close()
618
+			return "", errors.Wrapf(errdefs.ErrFailedPrecondition, "%q failed size validation: %v != %v", nw.ref, status.Offset, size)
611 619
 		}
612 620
 		size = status.Offset
613 621
 		actual = nw.w.Digest()
... ...
@@ -1,4 +1,4 @@
1
-// +build darwin freebsd
1
+// +build darwin freebsd openbsd
2 2
 
3 3
 /*
4 4
    Copyright The containerd Authors.
5 5
new file mode 100644
... ...
@@ -0,0 +1,63 @@
0
+// +build freebsd openbsd
1
+
2
+/*
3
+   Copyright The containerd Authors.
4
+
5
+   Licensed under the Apache License, Version 2.0 (the "License");
6
+   you may not use this file except in compliance with the License.
7
+   You may obtain a copy of the License at
8
+
9
+       http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+   Unless required by applicable law or agreed to in writing, software
12
+   distributed under the License is distributed on an "AS IS" BASIS,
13
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+   See the License for the specific language governing permissions and
15
+   limitations under the License.
16
+*/
17
+
18
+package mount
19
+
20
+/*
21
+#include <sys/param.h>
22
+#include <sys/ucred.h>
23
+#include <sys/mount.h>
24
+*/
25
+import "C"
26
+
27
+import (
28
+	"fmt"
29
+	"reflect"
30
+	"unsafe"
31
+)
32
+
33
+// Self retrieves a list of mounts for the current running process.
34
+func Self() ([]Info, error) {
35
+	var rawEntries *C.struct_statfs
36
+
37
+	count := int(C.getmntinfo(&rawEntries, C.MNT_WAIT))
38
+	if count == 0 {
39
+		return nil, fmt.Errorf("Failed to call getmntinfo")
40
+	}
41
+
42
+	var entries []C.struct_statfs
43
+	header := (*reflect.SliceHeader)(unsafe.Pointer(&entries))
44
+	header.Cap = count
45
+	header.Len = count
46
+	header.Data = uintptr(unsafe.Pointer(rawEntries))
47
+
48
+	var out []Info
49
+	for _, entry := range entries {
50
+		var mountinfo Info
51
+		mountinfo.Mountpoint = C.GoString(&entry.f_mntonname[0])
52
+		mountinfo.Source = C.GoString(&entry.f_mntfromname[0])
53
+		mountinfo.FSType = C.GoString(&entry.f_fstypename[0])
54
+		out = append(out, mountinfo)
55
+	}
56
+	return out, nil
57
+}
58
+
59
+// PID collects the mounts for a specific process ID.
60
+func PID(pid int) ([]Info, error) {
61
+	return nil, fmt.Errorf("mountinfo.PID is not implemented on freebsd")
62
+}
0 63
deleted file mode 100644
... ...
@@ -1,61 +0,0 @@
1
-/*
2
-   Copyright The containerd Authors.
3
-
4
-   Licensed under the Apache License, Version 2.0 (the "License");
5
-   you may not use this file except in compliance with the License.
6
-   You may obtain a copy of the License at
7
-
8
-       http://www.apache.org/licenses/LICENSE-2.0
9
-
10
-   Unless required by applicable law or agreed to in writing, software
11
-   distributed under the License is distributed on an "AS IS" BASIS,
12
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
-   See the License for the specific language governing permissions and
14
-   limitations under the License.
15
-*/
16
-
17
-package mount
18
-
19
-/*
20
-#include <sys/param.h>
21
-#include <sys/ucred.h>
22
-#include <sys/mount.h>
23
-*/
24
-import "C"
25
-
26
-import (
27
-	"fmt"
28
-	"reflect"
29
-	"unsafe"
30
-)
31
-
32
-// Self retrieves a list of mounts for the current running process.
33
-func Self() ([]Info, error) {
34
-	var rawEntries *C.struct_statfs
35
-
36
-	count := int(C.getmntinfo(&rawEntries, C.MNT_WAIT))
37
-	if count == 0 {
38
-		return nil, fmt.Errorf("Failed to call getmntinfo")
39
-	}
40
-
41
-	var entries []C.struct_statfs
42
-	header := (*reflect.SliceHeader)(unsafe.Pointer(&entries))
43
-	header.Cap = count
44
-	header.Len = count
45
-	header.Data = uintptr(unsafe.Pointer(rawEntries))
46
-
47
-	var out []Info
48
-	for _, entry := range entries {
49
-		var mountinfo Info
50
-		mountinfo.Mountpoint = C.GoString(&entry.f_mntonname[0])
51
-		mountinfo.Source = C.GoString(&entry.f_mntfromname[0])
52
-		mountinfo.FSType = C.GoString(&entry.f_fstypename[0])
53
-		out = append(out, mountinfo)
54
-	}
55
-	return out, nil
56
-}
57
-
58
-// PID collects the mounts for a specific process ID.
59
-func PID(pid int) ([]Info, error) {
60
-	return nil, fmt.Errorf("mountinfo.PID is not implemented on freebsd")
61
-}
... ...
@@ -1,4 +1,4 @@
1
-// +build !linux,!freebsd,!solaris freebsd,!cgo solaris,!cgo
1
+// +build !linux,!freebsd,!solaris,!openbsd freebsd,!cgo solaris,!cgo openbsd,!cgo
2 2
 
3 3
 /*
4 4
    Copyright The containerd Authors.
... ...
@@ -74,6 +74,22 @@ func getCPUInfo(pattern string) (info string, err error) {
74 74
 }
75 75
 
76 76
 func getCPUVariant() string {
77
+	if runtime.GOOS == "windows" {
78
+		// Windows only supports v7 for ARM32 and v8 for ARM64 and so we can use
79
+		// runtime.GOARCH to determine the variants
80
+		var variant string
81
+		switch runtime.GOARCH {
82
+		case "arm64":
83
+			variant = "v8"
84
+		case "arm":
85
+			variant = "v7"
86
+		default:
87
+			variant = "unknown"
88
+		}
89
+
90
+		return variant
91
+	}
92
+
77 93
 	variant, err := getCPUInfo("Cpu architecture")
78 94
 	if err != nil {
79 95
 		log.L.WithError(err).Error("failure getting variant")
... ...
@@ -80,11 +80,7 @@ func (a *dockerAuthorizer) AddResponses(ctx context.Context, responses []*http.R
80 80
 
81 81
 			// TODO(dmcg): Store challenge, not token
82 82
 			// Move token fetching to authorize
83
-			if err := a.setTokenAuth(ctx, host, c.parameters); err != nil {
84
-				return err
85
-			}
86
-
87
-			return nil
83
+			return a.setTokenAuth(ctx, host, c.parameters)
88 84
 		} else if c.scheme == basicAuth {
89 85
 			// TODO: Resolve credentials on authorize
90 86
 			username, secret, err := a.credentials(host)
... ...
@@ -24,6 +24,7 @@ import (
24 24
 	"fmt"
25 25
 	"io"
26 26
 	"io/ioutil"
27
+	"strconv"
27 28
 	"strings"
28 29
 	"sync"
29 30
 	"time"
... ...
@@ -42,7 +43,10 @@ import (
42 42
 	"github.com/pkg/errors"
43 43
 )
44 44
 
45
-const manifestSizeLimit = 8e6 // 8MB
45
+const (
46
+	manifestSizeLimit            = 8e6 // 8MB
47
+	labelDockerSchema1EmptyLayer = "containerd.io/docker.schema1.empty-layer"
48
+)
46 49
 
47 50
 type blobState struct {
48 51
 	diffID digest.Digest
... ...
@@ -353,10 +357,11 @@ func (c *Converter) fetchBlob(ctx context.Context, desc ocispec.Descriptor) erro
353 353
 		Digest: desc.Digest,
354 354
 		Labels: map[string]string{
355 355
 			"containerd.io/uncompressed": state.diffID.String(),
356
+			labelDockerSchema1EmptyLayer: strconv.FormatBool(state.empty),
356 357
 		},
357 358
 	}
358 359
 
359
-	if _, err := c.contentStore.Update(ctx, cinfo, "labels.containerd.io/uncompressed"); err != nil {
360
+	if _, err := c.contentStore.Update(ctx, cinfo, "labels.containerd.io/uncompressed", fmt.Sprintf("labels.%s", labelDockerSchema1EmptyLayer)); err != nil {
360 361
 		return errors.Wrap(err, "failed to update uncompressed label")
361 362
 	}
362 363
 
... ...
@@ -380,7 +385,18 @@ func (c *Converter) reuseLabelBlobState(ctx context.Context, desc ocispec.Descri
380 380
 		return false, nil
381 381
 	}
382 382
 
383
-	bState := blobState{empty: false}
383
+	emptyVal, ok := cinfo.Labels[labelDockerSchema1EmptyLayer]
384
+	if !ok {
385
+		return false, nil
386
+	}
387
+
388
+	isEmpty, err := strconv.ParseBool(emptyVal)
389
+	if err != nil {
390
+		log.G(ctx).WithField("id", desc.Digest).Warnf("failed to parse bool from label %s: %v", labelDockerSchema1EmptyLayer, isEmpty)
391
+		return false, nil
392
+	}
393
+
394
+	bState := blobState{empty: isEmpty}
384 395
 
385 396
 	if bState.diffID, err = digest.Parse(diffID); err != nil {
386 397
 		log.G(ctx).WithField("id", desc.Digest).Warnf("failed to parse digest from label containerd.io/uncompressed: %v", diffID)
387 398
deleted file mode 100644
... ...
@@ -1,109 +0,0 @@
1
-/*
2
-   Copyright The containerd Authors.
3
-
4
-   Licensed under the Apache License, Version 2.0 (the "License");
5
-   you may not use this file except in compliance with the License.
6
-   You may obtain a copy of the License at
7
-
8
-       http://www.apache.org/licenses/LICENSE-2.0
9
-
10
-   Unless required by applicable law or agreed to in writing, software
11
-   distributed under the License is distributed on an "AS IS" BASIS,
12
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
-   See the License for the specific language governing permissions and
14
-   limitations under the License.
15
-*/
16
-
17
-package server
18
-
19
-import (
20
-	"github.com/BurntSushi/toml"
21
-	"github.com/containerd/containerd/errdefs"
22
-	"github.com/pkg/errors"
23
-)
24
-
25
-// Config provides containerd configuration data for the server
26
-type Config struct {
27
-	// Root is the path to a directory where containerd will store persistent data
28
-	Root string `toml:"root"`
29
-	// State is the path to a directory where containerd will store transient data
30
-	State string `toml:"state"`
31
-	// GRPC configuration settings
32
-	GRPC GRPCConfig `toml:"grpc"`
33
-	// Debug and profiling settings
34
-	Debug Debug `toml:"debug"`
35
-	// Metrics and monitoring settings
36
-	Metrics MetricsConfig `toml:"metrics"`
37
-	// DisabledPlugins are IDs of plugins to disable. Disabled plugins won't be
38
-	// initialized and started.
39
-	DisabledPlugins []string `toml:"disabled_plugins"`
40
-	// Plugins provides plugin specific configuration for the initialization of a plugin
41
-	Plugins map[string]toml.Primitive `toml:"plugins"`
42
-	// OOMScore adjust the containerd's oom score
43
-	OOMScore int `toml:"oom_score"`
44
-	// Cgroup specifies cgroup information for the containerd daemon process
45
-	Cgroup CgroupConfig `toml:"cgroup"`
46
-	// ProxyPlugins configures plugins which are communicated to over GRPC
47
-	ProxyPlugins map[string]ProxyPlugin `toml:"proxy_plugins"`
48
-
49
-	md toml.MetaData
50
-}
51
-
52
-// GRPCConfig provides GRPC configuration for the socket
53
-type GRPCConfig struct {
54
-	Address        string `toml:"address"`
55
-	UID            int    `toml:"uid"`
56
-	GID            int    `toml:"gid"`
57
-	MaxRecvMsgSize int    `toml:"max_recv_message_size"`
58
-	MaxSendMsgSize int    `toml:"max_send_message_size"`
59
-}
60
-
61
-// Debug provides debug configuration
62
-type Debug struct {
63
-	Address string `toml:"address"`
64
-	UID     int    `toml:"uid"`
65
-	GID     int    `toml:"gid"`
66
-	Level   string `toml:"level"`
67
-}
68
-
69
-// MetricsConfig provides metrics configuration
70
-type MetricsConfig struct {
71
-	Address       string `toml:"address"`
72
-	GRPCHistogram bool   `toml:"grpc_histogram"`
73
-}
74
-
75
-// CgroupConfig provides cgroup configuration
76
-type CgroupConfig struct {
77
-	Path string `toml:"path"`
78
-}
79
-
80
-// ProxyPlugin provides a proxy plugin configuration
81
-type ProxyPlugin struct {
82
-	Type    string `toml:"type"`
83
-	Address string `toml:"address"`
84
-}
85
-
86
-// Decode unmarshals a plugin specific configuration by plugin id
87
-func (c *Config) Decode(id string, v interface{}) (interface{}, error) {
88
-	data, ok := c.Plugins[id]
89
-	if !ok {
90
-		return v, nil
91
-	}
92
-	if err := c.md.PrimitiveDecode(data, v); err != nil {
93
-		return nil, err
94
-	}
95
-	return v, nil
96
-}
97
-
98
-// LoadConfig loads the containerd server config from the provided path
99
-func LoadConfig(path string, v *Config) error {
100
-	if v == nil {
101
-		return errors.Wrapf(errdefs.ErrInvalidArgument, "argument v must not be nil")
102
-	}
103
-	md, err := toml.DecodeFile(path, v)
104
-	if err != nil {
105
-		return err
106
-	}
107
-	v.md = md
108
-	return nil
109
-}
110 1
new file mode 100644
... ...
@@ -0,0 +1,109 @@
0
+/*
1
+   Copyright The containerd Authors.
2
+
3
+   Licensed under the Apache License, Version 2.0 (the "License");
4
+   you may not use this file except in compliance with the License.
5
+   You may obtain a copy of the License at
6
+
7
+       http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+   Unless required by applicable law or agreed to in writing, software
10
+   distributed under the License is distributed on an "AS IS" BASIS,
11
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+   See the License for the specific language governing permissions and
13
+   limitations under the License.
14
+*/
15
+
16
+package config
17
+
18
+import (
19
+	"github.com/BurntSushi/toml"
20
+	"github.com/containerd/containerd/errdefs"
21
+	"github.com/pkg/errors"
22
+)
23
+
24
+// Config provides containerd configuration data for the server
25
+type Config struct {
26
+	// Root is the path to a directory where containerd will store persistent data
27
+	Root string `toml:"root"`
28
+	// State is the path to a directory where containerd will store transient data
29
+	State string `toml:"state"`
30
+	// GRPC configuration settings
31
+	GRPC GRPCConfig `toml:"grpc"`
32
+	// Debug and profiling settings
33
+	Debug Debug `toml:"debug"`
34
+	// Metrics and monitoring settings
35
+	Metrics MetricsConfig `toml:"metrics"`
36
+	// DisabledPlugins are IDs of plugins to disable. Disabled plugins won't be
37
+	// initialized and started.
38
+	DisabledPlugins []string `toml:"disabled_plugins"`
39
+	// Plugins provides plugin specific configuration for the initialization of a plugin
40
+	Plugins map[string]toml.Primitive `toml:"plugins"`
41
+	// OOMScore adjust the containerd's oom score
42
+	OOMScore int `toml:"oom_score"`
43
+	// Cgroup specifies cgroup information for the containerd daemon process
44
+	Cgroup CgroupConfig `toml:"cgroup"`
45
+	// ProxyPlugins configures plugins which are communicated to over GRPC
46
+	ProxyPlugins map[string]ProxyPlugin `toml:"proxy_plugins"`
47
+
48
+	md toml.MetaData
49
+}
50
+
51
+// GRPCConfig provides GRPC configuration for the socket
52
+type GRPCConfig struct {
53
+	Address        string `toml:"address"`
54
+	UID            int    `toml:"uid"`
55
+	GID            int    `toml:"gid"`
56
+	MaxRecvMsgSize int    `toml:"max_recv_message_size"`
57
+	MaxSendMsgSize int    `toml:"max_send_message_size"`
58
+}
59
+
60
+// Debug provides debug configuration
61
+type Debug struct {
62
+	Address string `toml:"address"`
63
+	UID     int    `toml:"uid"`
64
+	GID     int    `toml:"gid"`
65
+	Level   string `toml:"level"`
66
+}
67
+
68
+// MetricsConfig provides metrics configuration
69
+type MetricsConfig struct {
70
+	Address       string `toml:"address"`
71
+	GRPCHistogram bool   `toml:"grpc_histogram"`
72
+}
73
+
74
+// CgroupConfig provides cgroup configuration
75
+type CgroupConfig struct {
76
+	Path string `toml:"path"`
77
+}
78
+
79
+// ProxyPlugin provides a proxy plugin configuration
80
+type ProxyPlugin struct {
81
+	Type    string `toml:"type"`
82
+	Address string `toml:"address"`
83
+}
84
+
85
+// Decode unmarshals a plugin specific configuration by plugin id
86
+func (c *Config) Decode(id string, v interface{}) (interface{}, error) {
87
+	data, ok := c.Plugins[id]
88
+	if !ok {
89
+		return v, nil
90
+	}
91
+	if err := c.md.PrimitiveDecode(data, v); err != nil {
92
+		return nil, err
93
+	}
94
+	return v, nil
95
+}
96
+
97
+// LoadConfig loads the containerd server config from the provided path
98
+func LoadConfig(path string, v *Config) error {
99
+	if v == nil {
100
+		return errors.Wrapf(errdefs.ErrInvalidArgument, "argument v must not be nil")
101
+	}
102
+	md, err := toml.DecodeFile(path, v)
103
+	if err != nil {
104
+		return err
105
+	}
106
+	v.md = md
107
+	return nil
108
+}
0 109
deleted file mode 100644
... ...
@@ -1,362 +0,0 @@
1
-/*
2
-   Copyright The containerd Authors.
3
-
4
-   Licensed under the Apache License, Version 2.0 (the "License");
5
-   you may not use this file except in compliance with the License.
6
-   You may obtain a copy of the License at
7
-
8
-       http://www.apache.org/licenses/LICENSE-2.0
9
-
10
-   Unless required by applicable law or agreed to in writing, software
11
-   distributed under the License is distributed on an "AS IS" BASIS,
12
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
-   See the License for the specific language governing permissions and
14
-   limitations under the License.
15
-*/
16
-
17
-package server
18
-
19
-import (
20
-	"context"
21
-	"expvar"
22
-	"io"
23
-	"net"
24
-	"net/http"
25
-	"net/http/pprof"
26
-	"os"
27
-	"path/filepath"
28
-	"strings"
29
-	"sync"
30
-	"time"
31
-
32
-	csapi "github.com/containerd/containerd/api/services/content/v1"
33
-	ssapi "github.com/containerd/containerd/api/services/snapshots/v1"
34
-	"github.com/containerd/containerd/content"
35
-	"github.com/containerd/containerd/content/local"
36
-	csproxy "github.com/containerd/containerd/content/proxy"
37
-	"github.com/containerd/containerd/defaults"
38
-	"github.com/containerd/containerd/events/exchange"
39
-	"github.com/containerd/containerd/log"
40
-	"github.com/containerd/containerd/metadata"
41
-	"github.com/containerd/containerd/pkg/dialer"
42
-	"github.com/containerd/containerd/plugin"
43
-	"github.com/containerd/containerd/snapshots"
44
-	ssproxy "github.com/containerd/containerd/snapshots/proxy"
45
-	metrics "github.com/docker/go-metrics"
46
-	grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
47
-	"github.com/pkg/errors"
48
-	bolt "go.etcd.io/bbolt"
49
-	"google.golang.org/grpc"
50
-)
51
-
52
-// New creates and initializes a new containerd server
53
-func New(ctx context.Context, config *Config) (*Server, error) {
54
-	switch {
55
-	case config.Root == "":
56
-		return nil, errors.New("root must be specified")
57
-	case config.State == "":
58
-		return nil, errors.New("state must be specified")
59
-	case config.Root == config.State:
60
-		return nil, errors.New("root and state must be different paths")
61
-	}
62
-
63
-	if err := os.MkdirAll(config.Root, 0711); err != nil {
64
-		return nil, err
65
-	}
66
-	if err := os.MkdirAll(config.State, 0711); err != nil {
67
-		return nil, err
68
-	}
69
-	if err := apply(ctx, config); err != nil {
70
-		return nil, err
71
-	}
72
-	plugins, err := LoadPlugins(ctx, config)
73
-	if err != nil {
74
-		return nil, err
75
-	}
76
-
77
-	serverOpts := []grpc.ServerOption{
78
-		grpc.UnaryInterceptor(grpc_prometheus.UnaryServerInterceptor),
79
-		grpc.StreamInterceptor(grpc_prometheus.StreamServerInterceptor),
80
-	}
81
-	if config.GRPC.MaxRecvMsgSize > 0 {
82
-		serverOpts = append(serverOpts, grpc.MaxRecvMsgSize(config.GRPC.MaxRecvMsgSize))
83
-	}
84
-	if config.GRPC.MaxSendMsgSize > 0 {
85
-		serverOpts = append(serverOpts, grpc.MaxSendMsgSize(config.GRPC.MaxSendMsgSize))
86
-	}
87
-	rpc := grpc.NewServer(serverOpts...)
88
-	var (
89
-		services []plugin.Service
90
-		s        = &Server{
91
-			rpc:    rpc,
92
-			events: exchange.NewExchange(),
93
-			config: config,
94
-		}
95
-		initialized = plugin.NewPluginSet()
96
-	)
97
-	for _, p := range plugins {
98
-		id := p.URI()
99
-		log.G(ctx).WithField("type", p.Type).Infof("loading plugin %q...", id)
100
-
101
-		initContext := plugin.NewContext(
102
-			ctx,
103
-			p,
104
-			initialized,
105
-			config.Root,
106
-			config.State,
107
-		)
108
-		initContext.Events = s.events
109
-		initContext.Address = config.GRPC.Address
110
-
111
-		// load the plugin specific configuration if it is provided
112
-		if p.Config != nil {
113
-			pluginConfig, err := config.Decode(p.ID, p.Config)
114
-			if err != nil {
115
-				return nil, err
116
-			}
117
-			initContext.Config = pluginConfig
118
-		}
119
-		result := p.Init(initContext)
120
-		if err := initialized.Add(result); err != nil {
121
-			return nil, errors.Wrapf(err, "could not add plugin result to plugin set")
122
-		}
123
-
124
-		instance, err := result.Instance()
125
-		if err != nil {
126
-			if plugin.IsSkipPlugin(err) {
127
-				log.G(ctx).WithField("type", p.Type).Infof("skip loading plugin %q...", id)
128
-			} else {
129
-				log.G(ctx).WithError(err).Warnf("failed to load plugin %s", id)
130
-			}
131
-			continue
132
-		}
133
-		// check for grpc services that should be registered with the server
134
-		if service, ok := instance.(plugin.Service); ok {
135
-			services = append(services, service)
136
-		}
137
-		s.plugins = append(s.plugins, result)
138
-	}
139
-	// register services after all plugins have been initialized
140
-	for _, service := range services {
141
-		if err := service.Register(rpc); err != nil {
142
-			return nil, err
143
-		}
144
-	}
145
-	return s, nil
146
-}
147
-
148
-// Server is the containerd main daemon
149
-type Server struct {
150
-	rpc     *grpc.Server
151
-	events  *exchange.Exchange
152
-	config  *Config
153
-	plugins []*plugin.Plugin
154
-}
155
-
156
-// ServeGRPC provides the containerd grpc APIs on the provided listener
157
-func (s *Server) ServeGRPC(l net.Listener) error {
158
-	if s.config.Metrics.GRPCHistogram {
159
-		// enable grpc time histograms to measure rpc latencies
160
-		grpc_prometheus.EnableHandlingTimeHistogram()
161
-	}
162
-	// before we start serving the grpc API register the grpc_prometheus metrics
163
-	// handler.  This needs to be the last service registered so that it can collect
164
-	// metrics for every other service
165
-	grpc_prometheus.Register(s.rpc)
166
-	return trapClosedConnErr(s.rpc.Serve(l))
167
-}
168
-
169
-// ServeMetrics provides a prometheus endpoint for exposing metrics
170
-func (s *Server) ServeMetrics(l net.Listener) error {
171
-	m := http.NewServeMux()
172
-	m.Handle("/v1/metrics", metrics.Handler())
173
-	return trapClosedConnErr(http.Serve(l, m))
174
-}
175
-
176
-// ServeDebug provides a debug endpoint
177
-func (s *Server) ServeDebug(l net.Listener) error {
178
-	// don't use the default http server mux to make sure nothing gets registered
179
-	// that we don't want to expose via containerd
180
-	m := http.NewServeMux()
181
-	m.Handle("/debug/vars", expvar.Handler())
182
-	m.Handle("/debug/pprof/", http.HandlerFunc(pprof.Index))
183
-	m.Handle("/debug/pprof/cmdline", http.HandlerFunc(pprof.Cmdline))
184
-	m.Handle("/debug/pprof/profile", http.HandlerFunc(pprof.Profile))
185
-	m.Handle("/debug/pprof/symbol", http.HandlerFunc(pprof.Symbol))
186
-	m.Handle("/debug/pprof/trace", http.HandlerFunc(pprof.Trace))
187
-	return trapClosedConnErr(http.Serve(l, m))
188
-}
189
-
190
-// Stop the containerd server canceling any open connections
191
-func (s *Server) Stop() {
192
-	s.rpc.Stop()
193
-	for i := len(s.plugins) - 1; i >= 0; i-- {
194
-		p := s.plugins[i]
195
-		instance, err := p.Instance()
196
-		if err != nil {
197
-			log.L.WithError(err).WithField("id", p.Registration.ID).
198
-				Errorf("could not get plugin instance")
199
-			continue
200
-		}
201
-		closer, ok := instance.(io.Closer)
202
-		if !ok {
203
-			continue
204
-		}
205
-		if err := closer.Close(); err != nil {
206
-			log.L.WithError(err).WithField("id", p.Registration.ID).
207
-				Errorf("failed to close plugin")
208
-		}
209
-	}
210
-}
211
-
212
-// LoadPlugins loads all plugins into containerd and generates an ordered graph
213
-// of all plugins.
214
-func LoadPlugins(ctx context.Context, config *Config) ([]*plugin.Registration, error) {
215
-	// load all plugins into containerd
216
-	if err := plugin.Load(filepath.Join(config.Root, "plugins")); err != nil {
217
-		return nil, err
218
-	}
219
-	// load additional plugins that don't automatically register themselves
220
-	plugin.Register(&plugin.Registration{
221
-		Type: plugin.ContentPlugin,
222
-		ID:   "content",
223
-		InitFn: func(ic *plugin.InitContext) (interface{}, error) {
224
-			ic.Meta.Exports["root"] = ic.Root
225
-			return local.NewStore(ic.Root)
226
-		},
227
-	})
228
-	plugin.Register(&plugin.Registration{
229
-		Type: plugin.MetadataPlugin,
230
-		ID:   "bolt",
231
-		Requires: []plugin.Type{
232
-			plugin.ContentPlugin,
233
-			plugin.SnapshotPlugin,
234
-		},
235
-		InitFn: func(ic *plugin.InitContext) (interface{}, error) {
236
-			if err := os.MkdirAll(ic.Root, 0711); err != nil {
237
-				return nil, err
238
-			}
239
-			cs, err := ic.Get(plugin.ContentPlugin)
240
-			if err != nil {
241
-				return nil, err
242
-			}
243
-
244
-			snapshottersRaw, err := ic.GetByType(plugin.SnapshotPlugin)
245
-			if err != nil {
246
-				return nil, err
247
-			}
248
-
249
-			snapshotters := make(map[string]snapshots.Snapshotter)
250
-			for name, sn := range snapshottersRaw {
251
-				sn, err := sn.Instance()
252
-				if err != nil {
253
-					log.G(ic.Context).WithError(err).
254
-						Warnf("could not use snapshotter %v in metadata plugin", name)
255
-					continue
256
-				}
257
-				snapshotters[name] = sn.(snapshots.Snapshotter)
258
-			}
259
-
260
-			path := filepath.Join(ic.Root, "meta.db")
261
-			ic.Meta.Exports["path"] = path
262
-
263
-			db, err := bolt.Open(path, 0644, nil)
264
-			if err != nil {
265
-				return nil, err
266
-			}
267
-			mdb := metadata.NewDB(db, cs.(content.Store), snapshotters)
268
-			if err := mdb.Init(ic.Context); err != nil {
269
-				return nil, err
270
-			}
271
-			return mdb, nil
272
-		},
273
-	})
274
-
275
-	clients := &proxyClients{}
276
-	for name, pp := range config.ProxyPlugins {
277
-		var (
278
-			t plugin.Type
279
-			f func(*grpc.ClientConn) interface{}
280
-
281
-			address = pp.Address
282
-		)
283
-
284
-		switch pp.Type {
285
-		case string(plugin.SnapshotPlugin), "snapshot":
286
-			t = plugin.SnapshotPlugin
287
-			ssname := name
288
-			f = func(conn *grpc.ClientConn) interface{} {
289
-				return ssproxy.NewSnapshotter(ssapi.NewSnapshotsClient(conn), ssname)
290
-			}
291
-
292
-		case string(plugin.ContentPlugin), "content":
293
-			t = plugin.ContentPlugin
294
-			f = func(conn *grpc.ClientConn) interface{} {
295
-				return csproxy.NewContentStore(csapi.NewContentClient(conn))
296
-			}
297
-		default:
298
-			log.G(ctx).WithField("type", pp.Type).Warn("unknown proxy plugin type")
299
-		}
300
-
301
-		plugin.Register(&plugin.Registration{
302
-			Type: t,
303
-			ID:   name,
304
-			InitFn: func(ic *plugin.InitContext) (interface{}, error) {
305
-				ic.Meta.Exports["address"] = address
306
-				conn, err := clients.getClient(address)
307
-				if err != nil {
308
-					return nil, err
309
-				}
310
-				return f(conn), nil
311
-			},
312
-		})
313
-
314
-	}
315
-
316
-	// return the ordered graph for plugins
317
-	return plugin.Graph(config.DisabledPlugins), nil
318
-}
319
-
320
-type proxyClients struct {
321
-	m       sync.Mutex
322
-	clients map[string]*grpc.ClientConn
323
-}
324
-
325
-func (pc *proxyClients) getClient(address string) (*grpc.ClientConn, error) {
326
-	pc.m.Lock()
327
-	defer pc.m.Unlock()
328
-	if pc.clients == nil {
329
-		pc.clients = map[string]*grpc.ClientConn{}
330
-	} else if c, ok := pc.clients[address]; ok {
331
-		return c, nil
332
-	}
333
-
334
-	gopts := []grpc.DialOption{
335
-		grpc.WithInsecure(),
336
-		grpc.WithBackoffMaxDelay(3 * time.Second),
337
-		grpc.WithDialer(dialer.Dialer),
338
-
339
-		// TODO(stevvooe): We may need to allow configuration of this on the client.
340
-		grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(defaults.DefaultMaxRecvMsgSize)),
341
-		grpc.WithDefaultCallOptions(grpc.MaxCallSendMsgSize(defaults.DefaultMaxSendMsgSize)),
342
-	}
343
-
344
-	conn, err := grpc.Dial(dialer.DialAddress(address), gopts...)
345
-	if err != nil {
346
-		return nil, errors.Wrapf(err, "failed to dial %q", address)
347
-	}
348
-
349
-	pc.clients[address] = conn
350
-
351
-	return conn, nil
352
-}
353
-
354
-func trapClosedConnErr(err error) error {
355
-	if err == nil {
356
-		return nil
357
-	}
358
-	if strings.Contains(err.Error(), "use of closed network connection") {
359
-		return nil
360
-	}
361
-	return err
362
-}
363 1
deleted file mode 100644
... ...
@@ -1,54 +0,0 @@
1
-/*
2
-   Copyright The containerd Authors.
3
-
4
-   Licensed under the Apache License, Version 2.0 (the "License");
5
-   you may not use this file except in compliance with the License.
6
-   You may obtain a copy of the License at
7
-
8
-       http://www.apache.org/licenses/LICENSE-2.0
9
-
10
-   Unless required by applicable law or agreed to in writing, software
11
-   distributed under the License is distributed on an "AS IS" BASIS,
12
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
-   See the License for the specific language governing permissions and
14
-   limitations under the License.
15
-*/
16
-
17
-package server
18
-
19
-import (
20
-	"context"
21
-	"os"
22
-
23
-	"github.com/containerd/cgroups"
24
-	"github.com/containerd/containerd/log"
25
-	"github.com/containerd/containerd/sys"
26
-	specs "github.com/opencontainers/runtime-spec/specs-go"
27
-)
28
-
29
-// apply sets config settings on the server process
30
-func apply(ctx context.Context, config *Config) error {
31
-	if config.OOMScore != 0 {
32
-		log.G(ctx).Debugf("changing OOM score to %d", config.OOMScore)
33
-		if err := sys.SetOOMScore(os.Getpid(), config.OOMScore); err != nil {
34
-			log.G(ctx).WithError(err).Errorf("failed to change OOM score to %d", config.OOMScore)
35
-		}
36
-	}
37
-	if config.Cgroup.Path != "" {
38
-		cg, err := cgroups.Load(cgroups.V1, cgroups.StaticPath(config.Cgroup.Path))
39
-		if err != nil {
40
-			if err != cgroups.ErrCgroupDeleted {
41
-				return err
42
-			}
43
-			if cg, err = cgroups.New(cgroups.V1, cgroups.StaticPath(config.Cgroup.Path), &specs.LinuxResources{}); err != nil {
44
-				return err
45
-			}
46
-		}
47
-		if err := cg.Add(cgroups.Process{
48
-			Pid: os.Getpid(),
49
-		}); err != nil {
50
-			return err
51
-		}
52
-	}
53
-	return nil
54
-}
55 1
deleted file mode 100644
... ...
@@ -1,23 +0,0 @@
1
-/*
2
-   Copyright The containerd Authors.
3
-
4
-   Licensed under the Apache License, Version 2.0 (the "License");
5
-   you may not use this file except in compliance with the License.
6
-   You may obtain a copy of the License at
7
-
8
-       http://www.apache.org/licenses/LICENSE-2.0
9
-
10
-   Unless required by applicable law or agreed to in writing, software
11
-   distributed under the License is distributed on an "AS IS" BASIS,
12
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
-   See the License for the specific language governing permissions and
14
-   limitations under the License.
15
-*/
16
-
17
-package server
18
-
19
-import "context"
20
-
21
-func apply(_ context.Context, _ *Config) error {
22
-	return nil
23
-}
24 1
deleted file mode 100644
... ...
@@ -1,25 +0,0 @@
1
-// +build !linux,!windows,!solaris
2
-
3
-/*
4
-   Copyright The containerd Authors.
5
-
6
-   Licensed under the Apache License, Version 2.0 (the "License");
7
-   you may not use this file except in compliance with the License.
8
-   You may obtain a copy of the License at
9
-
10
-       http://www.apache.org/licenses/LICENSE-2.0
11
-
12
-   Unless required by applicable law or agreed to in writing, software
13
-   distributed under the License is distributed on an "AS IS" BASIS,
14
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
-   See the License for the specific language governing permissions and
16
-   limitations under the License.
17
-*/
18
-
19
-package server
20
-
21
-import "context"
22
-
23
-func apply(_ context.Context, _ *Config) error {
24
-	return nil
25
-}
26 1
deleted file mode 100644
... ...
@@ -1,27 +0,0 @@
1
-// +build windows
2
-
3
-/*
4
-   Copyright The containerd Authors.
5
-
6
-   Licensed under the Apache License, Version 2.0 (the "License");
7
-   you may not use this file except in compliance with the License.
8
-   You may obtain a copy of the License at
9
-
10
-       http://www.apache.org/licenses/LICENSE-2.0
11
-
12
-   Unless required by applicable law or agreed to in writing, software
13
-   distributed under the License is distributed on an "AS IS" BASIS,
14
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
-   See the License for the specific language governing permissions and
16
-   limitations under the License.
17
-*/
18
-
19
-package server
20
-
21
-import (
22
-	"context"
23
-)
24
-
25
-func apply(_ context.Context, _ *Config) error {
26
-	return nil
27
-}
... ...
@@ -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 00dc70017d222b178a002ed30e9321b12647af2d
23
+github.com/opencontainers/runc 58592df56734acf62e574865fe40b9e53e967910
24 24
 github.com/sirupsen/logrus v1.0.0
25 25
 github.com/urfave/cli 7bc6a0acffa589f415f88aca16cc1de5ffd66f9c
26 26
 golang.org/x/net b3756b4b77d7b13260a0a2ec658753cf48922eac
... ...
@@ -32,8 +32,8 @@ github.com/opencontainers/image-spec v1.0.1
32 32
 golang.org/x/sync 450f422ab23cf9881c94e2db30cac0eb1b7cf80c
33 33
 github.com/BurntSushi/toml a368813c5e648fee92e5f6c30e3944ff9d5e8895
34 34
 github.com/grpc-ecosystem/go-grpc-prometheus 6b7015e65d366bf3f19b2b2a000a831940f0f7e0
35
-github.com/Microsoft/go-winio v0.4.10
36
-github.com/Microsoft/hcsshim v0.7.6
35
+github.com/Microsoft/go-winio v0.4.11
36
+github.com/Microsoft/hcsshim v0.7.12
37 37
 google.golang.org/genproto d80a6e20e776b0b17a324d0ba1ab50a39c8e8944
38 38
 golang.org/x/text 19e51611da83d6be54ddafce4a4af510cb3e9ea4
39 39
 github.com/containerd/ttrpc 2a805f71863501300ae1976d29f0454ae003e85a
... ...
@@ -43,8 +43,8 @@ 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 9f39e3289533fc228c5e5fcac0a6dbdd60c6047b # release/1.2 branch
47
-github.com/containerd/go-cni 6d7b509a054a3cb1c35ed1865d4fde2f0cb547cd
46
+github.com/containerd/cri f913714917d2456d7e65a0be84962b1ce8acb487 # release/1.2 branch
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
50 50
 github.com/containernetworking/plugins v0.7.0
... ...
@@ -73,12 +73,12 @@ golang.org/x/oauth2 a6bd8cefa1811bd24b86f8902872e4e8225f74c4
73 73
 golang.org/x/time f51c12702a4d776e4c1fa9b0fabab841babae631
74 74
 gopkg.in/inf.v0 3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4
75 75
 gopkg.in/yaml.v2 v2.2.1
76
-k8s.io/api 012f271b5d41baad56190c5f1ae19bff16df0fd8
77
-k8s.io/apimachinery 6429050ef506887d121f3e7306e894f8900d8a63
78
-k8s.io/apiserver e9312c15296b6c2c923ebd5031ff5d1d5fd022d7
79
-k8s.io/client-go 37c3c02ec96533daec0dbda1f39a6b1d68505c79
80
-k8s.io/kubernetes v1.12.0-beta.1
81
-k8s.io/utils 982821ea41da7e7c15f3d3738921eb2e7e241ccd
76
+k8s.io/api kubernetes-1.12.0
77
+k8s.io/apimachinery kubernetes-1.12.0
78
+k8s.io/apiserver kubernetes-1.12.0
79
+k8s.io/client-go kubernetes-1.12.0
80
+k8s.io/kubernetes v1.12.0
81
+k8s.io/utils cd34563cd63c2bd7c6fe88a73c4dcf34ed8a67cb
82 82
 
83 83
 # zfs dependencies
84 84
 github.com/containerd/zfs 9a0b8b8b5982014b729cd34eb7cd7a11062aa6ec
... ...
@@ -1,15 +1,14 @@
1 1
 github.com/beorn7/perks 4c0e84591b9aa9e6dcfdf3e020114cd81f89d5f9
2 2
 github.com/blang/semver v3.1.0
3
-github.com/boltdb/bolt v1.3.1
4 3
 github.com/BurntSushi/toml a368813c5e648fee92e5f6c30e3944ff9d5e8895
5 4
 github.com/containerd/cgroups 5e610833b72089b37d0e615de9a92dfc043757c2
6 5
 github.com/containerd/console c12b1e7919c14469339a5d38f2f8ed9b64a9de23
7
-github.com/containerd/containerd 1950f791d9225ffe061c77e74e292bcb3c428a04
8
-github.com/containerd/continuity f44b615e492bdfb371aae2f76ec694d9da1db537
6
+github.com/containerd/containerd 15f19d7a67fa322e6de0ef4c6a1bf9da0f056554
7
+github.com/containerd/continuity bd77b46c8352f74eb12c85bdc01f4b90f69d66b4
9 8
 github.com/containerd/fifo 3d5202aec260678c48179c56f40e6f38a095738c
10
-github.com/containerd/go-cni 6d7b509a054a3cb1c35ed1865d4fde2f0cb547cd
9
+github.com/containerd/go-cni 40bcf8ec8acd7372be1d77031d585d5d8e561c90
11 10
 github.com/containerd/go-runc 5a6d9f37cfa36b15efba46dc7ea349fa9b7143c3
12
-github.com/containerd/ttrpc 94dde388801693c54f88a6596f713b51a8b30b2d
11
+github.com/containerd/ttrpc 2a805f71863501300ae1976d29f0454ae003e85a
13 12
 github.com/containerd/typeurl a93fcdb778cd272c6e9b3028b2f42d813e785d40
14 13
 github.com/containernetworking/cni v0.6.0
15 14
 github.com/containernetworking/plugins v0.7.0
... ...
@@ -35,13 +34,13 @@ github.com/hashicorp/go-multierror ed905158d87462226a13fe39ddf685ea65f1c11f
35 35
 github.com/json-iterator/go 1.1.5
36 36
 github.com/matttproud/golang_protobuf_extensions v1.0.0
37 37
 github.com/Microsoft/go-winio v0.4.10
38
-github.com/Microsoft/hcsshim 44c060121b68e8bdc40b411beba551f3b4ee9e55
38
+github.com/Microsoft/hcsshim v0.7.6
39 39
 github.com/modern-go/concurrent 1.0.3
40 40
 github.com/modern-go/reflect2 1.0.1
41 41
 github.com/opencontainers/go-digest c9281466c8b2f606084ac71339773efd177436e7
42 42
 github.com/opencontainers/image-spec v1.0.1
43
-github.com/opencontainers/runc 20aff4f0488c6d4b8df4d85b4f63f1f704c11abd
44
-github.com/opencontainers/runtime-spec d810dbc60d8c5aeeb3d054bd1132fab2121968ce
43
+github.com/opencontainers/runc 00dc70017d222b178a002ed30e9321b12647af2d
44
+github.com/opencontainers/runtime-spec eba862dc2470385a233c7507392675cbeadf7353
45 45
 github.com/opencontainers/runtime-tools v0.6.0
46 46
 github.com/opencontainers/selinux b6fa367ed7f534f9ba25391cc2d467085dbb445a
47 47
 github.com/pkg/errors v0.8.0
... ...
@@ -59,6 +58,7 @@ github.com/urfave/cli 7bc6a0acffa589f415f88aca16cc1de5ffd66f9c
59 59
 github.com/xeipuuv/gojsonpointer 4e3ac2762d5f479393488629ee9370b50873b3a6
60 60
 github.com/xeipuuv/gojsonreference bd5ef7bd5415a7ac448318e64f11a24cd21e594b
61 61
 github.com/xeipuuv/gojsonschema 1d523034197ff1f222f6429836dd36a2457a1874
62
+go.etcd.io/bbolt v1.3.1-etcd.8
62 63
 golang.org/x/crypto 49796115aa4b964c318aad4f3084fdb41e9aa067
63 64
 golang.org/x/net b3756b4b77d7b13260a0a2ec658753cf48922eac
64 65
 golang.org/x/oauth2 a6bd8cefa1811bd24b86f8902872e4e8225f74c4
... ...
@@ -70,9 +70,9 @@ google.golang.org/genproto d80a6e20e776b0b17a324d0ba1ab50a39c8e8944
70 70
 google.golang.org/grpc v1.12.0
71 71
 gopkg.in/inf.v0 3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4
72 72
 gopkg.in/yaml.v2 53feefa2559fb8dfa8d81baad31be332c97d6c77
73
-k8s.io/api 012f271b5d41baad56190c5f1ae19bff16df0fd8
74
-k8s.io/apimachinery 6429050ef506887d121f3e7306e894f8900d8a63
75
-k8s.io/apiserver e9312c15296b6c2c923ebd5031ff5d1d5fd022d7
76
-k8s.io/client-go 37c3c02ec96533daec0dbda1f39a6b1d68505c79
77
-k8s.io/kubernetes v1.12.0-beta.1
78
-k8s.io/utils 982821ea41da7e7c15f3d3738921eb2e7e241ccd
73
+k8s.io/api kubernetes-1.12.0
74
+k8s.io/apimachinery kubernetes-1.12.0
75
+k8s.io/apiserver kubernetes-1.12.0
76
+k8s.io/client-go kubernetes-1.12.0
77
+k8s.io/kubernetes v1.12.0
78
+k8s.io/utils cd34563cd63c2bd7c6fe88a73c4dcf34ed8a67cb
... ...
@@ -186,8 +186,8 @@ type Config struct {
186 186
 	// callers keyring in this case.
187 187
 	NoNewKeyring bool `json:"no_new_keyring"`
188 188
 
189
-	// IntelRdt specifies settings for Intel RDT/CAT group that the container is placed into
190
-	// to limit the resources (e.g., L3 cache) the container has available
189
+	// IntelRdt specifies settings for Intel RDT group that the container is placed into
190
+	// to limit the resources (e.g., L3 cache, memory bandwidth) the container has available
191 191
 	IntelRdt *IntelRdt `json:"intel_rdt,omitempty"`
192 192
 
193 193
 	// RootlessEUID is set when the runc was launched with non-zero EUID.
... ...
@@ -4,4 +4,8 @@ type IntelRdt struct {
4 4
 	// The schema for L3 cache id and capacity bitmask (CBM)
5 5
 	// Format: "L3:<cache_id0>=<cbm0>;<cache_id1>=<cbm1>;..."
6 6
 	L3CacheSchema string `json:"l3_cache_schema,omitempty"`
7
+
8
+	// The schema of memory bandwidth percentage per L3 cache id
9
+	// Format: "MB:<cache_id0>=bandwidth0;<cache_id1>=bandwidth1;..."
10
+	MemBwSchema string `json:"memBwSchema,omitempty"`
7 11
 }
... ...
@@ -5,6 +5,7 @@ package user
5 5
 import (
6 6
 	"io"
7 7
 	"os"
8
+	"strconv"
8 9
 
9 10
 	"golang.org/x/sys/unix"
10 11
 )
... ...
@@ -115,22 +116,23 @@ func CurrentGroup() (Group, error) {
115 115
 	return LookupGid(unix.Getgid())
116 116
 }
117 117
 
118
-func CurrentUserSubUIDs() ([]SubID, error) {
118
+func currentUserSubIDs(fileName string) ([]SubID, error) {
119 119
 	u, err := CurrentUser()
120 120
 	if err != nil {
121 121
 		return nil, err
122 122
 	}
123
-	return ParseSubIDFileFilter("/etc/subuid",
124
-		func(entry SubID) bool { return entry.Name == u.Name })
123
+	filter := func(entry SubID) bool {
124
+		return entry.Name == u.Name || entry.Name == strconv.Itoa(u.Uid)
125
+	}
126
+	return ParseSubIDFileFilter(fileName, filter)
125 127
 }
126 128
 
127
-func CurrentGroupSubGIDs() ([]SubID, error) {
128
-	g, err := CurrentGroup()
129
-	if err != nil {
130
-		return nil, err
131
-	}
132
-	return ParseSubIDFileFilter("/etc/subgid",
133
-		func(entry SubID) bool { return entry.Name == g.Name })
129
+func CurrentUserSubUIDs() ([]SubID, error) {
130
+	return currentUserSubIDs("/etc/subuid")
131
+}
132
+
133
+func CurrentUserSubGIDs() ([]SubID, error) {
134
+	return currentUserSubIDs("/etc/subgid")
134 135
 }
135 136
 
136 137
 func CurrentProcessUIDMap() ([]IDMap, error) {
... ...
@@ -1,7 +1,7 @@
1 1
 # OCI runtime-spec. When updating this, make sure you use a version tag rather
2 2
 # than a commit ID so it's much more obvious what version of the spec we are
3 3
 # using.
4
-github.com/opencontainers/runtime-spec v1.0.0
4
+github.com/opencontainers/runtime-spec 5684b8af48c1ac3b1451fa499724e30e3c20a294
5 5
 # Core libcontainer functionality.
6 6
 github.com/mrunalp/fileutils ed869b029674c0e9ce4c0dfa781405c2d9946d08
7 7
 github.com/opencontainers/selinux v1.0.0-rc1
... ...
@@ -160,8 +160,8 @@ type Linux struct {
160 160
 	ReadonlyPaths []string `json:"readonlyPaths,omitempty"`
161 161
 	// MountLabel specifies the selinux context for the mounts in the container.
162 162
 	MountLabel string `json:"mountLabel,omitempty"`
163
-	// IntelRdt contains Intel Resource Director Technology (RDT) information
164
-	// for handling resource constraints (e.g., L3 cache) for the container
163
+	// IntelRdt contains Intel Resource Director Technology (RDT) information for
164
+	// handling resource constraints (e.g., L3 cache, memory bandwidth) for the container
165 165
 	IntelRdt *LinuxIntelRdt `json:"intelRdt,omitempty"`
166 166
 }
167 167
 
... ...
@@ -623,10 +623,16 @@ type LinuxSyscall struct {
623 623
 	Args   []LinuxSeccompArg  `json:"args,omitempty"`
624 624
 }
625 625
 
626
-// LinuxIntelRdt has container runtime resource constraints
627
-// for Intel RDT/CAT which introduced in Linux 4.10 kernel
626
+// LinuxIntelRdt has container runtime resource constraints for Intel RDT
627
+// CAT and MBA features which introduced in Linux 4.10 and 4.12 kernel
628 628
 type LinuxIntelRdt struct {
629
+	// The identity for RDT Class of Service
630
+	ClosID string `json:"closID,omitempty"`
629 631
 	// The schema for L3 cache id and capacity bitmask (CBM)
630 632
 	// Format: "L3:<cache_id0>=<cbm0>;<cache_id1>=<cbm1>;..."
631 633
 	L3CacheSchema string `json:"l3CacheSchema,omitempty"`
634
+
635
+	// The schema of memory bandwidth percentage per L3 cache id
636
+	// Format: "MB:<cache_id0>=bandwidth0;<cache_id1>=bandwidth1;..."
637
+	MemBwSchema string `json:"memBwSchema,omitempty"`
632 638
 }