Bump hcsshim to b3f49c06ffaeef24d09c6c08ec8ec8425a0303e2
| ... | ... |
@@ -3945,11 +3945,12 @@ func (s *DockerSuite) TestRunAttachFailedNoLeak(c *testing.T) {
|
| 3945 | 3945 |
assert.Assert(c, err != nil, "Command should have failed but succeeded with: %s\nContainer 'test' [%+v]: %s\nContainer 'fail' [%+v]: %s", out, err1, out1, err2, out2) |
| 3946 | 3946 |
// check for windows error as well |
| 3947 | 3947 |
// TODO Windows Post TP5. Fix the error message string |
| 3948 |
- assert.Assert(c, strings.Contains(out, "port is already allocated") || |
|
| 3949 |
- strings.Contains(out, "were not connected because a duplicate name exists") || |
|
| 3950 |
- strings.Contains(out, "The specified port already exists") || |
|
| 3951 |
- strings.Contains(out, "HNS failed with error : Failed to create endpoint") || |
|
| 3952 |
- strings.Contains(out, "HNS failed with error : The object already exists"), fmt.Sprintf("Output: %s", out))
|
|
| 3948 |
+ outLowerCase := strings.ToLower(out) |
|
| 3949 |
+ assert.Assert(c, strings.Contains(outLowerCase, "port is already allocated") || |
|
| 3950 |
+ strings.Contains(outLowerCase, "were not connected because a duplicate name exists") || |
|
| 3951 |
+ strings.Contains(outLowerCase, "the specified port already exists") || |
|
| 3952 |
+ strings.Contains(outLowerCase, "hns failed with error : failed to create endpoint") || |
|
| 3953 |
+ strings.Contains(outLowerCase, "hns failed with error : the object already exists"), fmt.Sprintf("Output: %s", out))
|
|
| 3953 | 3954 |
dockerCmd(c, "rm", "-f", "test") |
| 3954 | 3955 |
|
| 3955 | 3956 |
// NGoroutines is not updated right away, so we need to wait before failing |
| ... | ... |
@@ -1,5 +1,5 @@ |
| 1 | 1 |
github.com/Azure/go-ansiterm d6e3b3328b783f23731bc4d058875b0371ff8109 |
| 2 |
-github.com/Microsoft/hcsshim 2226e083fc390003ae5aa8325c3c92789afa0e7a |
|
| 2 |
+github.com/Microsoft/hcsshim b3f49c06ffaeef24d09c6c08ec8ec8425a0303e2 |
|
| 3 | 3 |
github.com/Microsoft/go-winio 6c72808b55902eae4c5943626030429ff20f3b63 # v0.4.14 |
| 4 | 4 |
github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a |
| 5 | 5 |
github.com/golang/gddo 72a348e765d293ed6d1ded7b699591f14d6cd921 |
| ... | ... |
@@ -1,33 +1,19 @@ |
| 1 | 1 |
// Code generated by protoc-gen-gogo. DO NOT EDIT. |
| 2 | 2 |
// source: github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options/runhcs.proto |
| 3 | 3 |
|
| 4 |
-/* |
|
| 5 |
- Package options is a generated protocol buffer package. |
|
| 6 |
- |
|
| 7 |
- It is generated from these files: |
|
| 8 |
- github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options/runhcs.proto |
|
| 9 |
- |
|
| 10 |
- It has these top-level messages: |
|
| 11 |
- Options |
|
| 12 |
- ProcessDetails |
|
| 13 |
-*/ |
|
| 14 | 4 |
package options |
| 15 | 5 |
|
| 16 |
-import proto "github.com/gogo/protobuf/proto" |
|
| 17 |
-import fmt "fmt" |
|
| 18 |
-import math "math" |
|
| 19 |
- |
|
| 20 |
-// skipping weak import gogoproto "github.com/gogo/protobuf/gogoproto" |
|
| 21 |
-import _ "github.com/gogo/protobuf/types" |
|
| 22 |
- |
|
| 23 |
-import time "time" |
|
| 24 |
- |
|
| 25 |
-import types "github.com/gogo/protobuf/types" |
|
| 26 |
- |
|
| 27 |
-import strings "strings" |
|
| 28 |
-import reflect "reflect" |
|
| 29 |
- |
|
| 30 |
-import io "io" |
|
| 6 |
+import ( |
|
| 7 |
+ fmt "fmt" |
|
| 8 |
+ proto "github.com/gogo/protobuf/proto" |
|
| 9 |
+ _ "github.com/gogo/protobuf/types" |
|
| 10 |
+ github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" |
|
| 11 |
+ io "io" |
|
| 12 |
+ math "math" |
|
| 13 |
+ reflect "reflect" |
|
| 14 |
+ strings "strings" |
|
| 15 |
+ time "time" |
|
| 16 |
+) |
|
| 31 | 17 |
|
| 32 | 18 |
// Reference imports to suppress errors if they are not otherwise used. |
| 33 | 19 |
var _ = proto.Marshal |
| ... | ... |
@@ -54,6 +40,7 @@ var Options_DebugType_name = map[int32]string{
|
| 54 | 54 |
1: "FILE", |
| 55 | 55 |
2: "ETW", |
| 56 | 56 |
} |
| 57 |
+ |
|
| 57 | 58 |
var Options_DebugType_value = map[string]int32{
|
| 58 | 59 |
"NPIPE": 0, |
| 59 | 60 |
"FILE": 1, |
| ... | ... |
@@ -63,7 +50,10 @@ var Options_DebugType_value = map[string]int32{
|
| 63 | 63 |
func (x Options_DebugType) String() string {
|
| 64 | 64 |
return proto.EnumName(Options_DebugType_name, int32(x)) |
| 65 | 65 |
} |
| 66 |
-func (Options_DebugType) EnumDescriptor() ([]byte, []int) { return fileDescriptorRunhcs, []int{0, 0} }
|
|
| 66 |
+ |
|
| 67 |
+func (Options_DebugType) EnumDescriptor() ([]byte, []int) {
|
|
| 68 |
+ return fileDescriptor_b643df6839c75082, []int{0, 0}
|
|
| 69 |
+} |
|
| 67 | 70 |
|
| 68 | 71 |
type Options_SandboxIsolation int32 |
| 69 | 72 |
|
| ... | ... |
@@ -76,6 +66,7 @@ var Options_SandboxIsolation_name = map[int32]string{
|
| 76 | 76 |
0: "PROCESS", |
| 77 | 77 |
1: "HYPERVISOR", |
| 78 | 78 |
} |
| 79 |
+ |
|
| 79 | 80 |
var Options_SandboxIsolation_value = map[string]int32{
|
| 80 | 81 |
"PROCESS": 0, |
| 81 | 82 |
"HYPERVISOR": 1, |
| ... | ... |
@@ -84,8 +75,9 @@ var Options_SandboxIsolation_value = map[string]int32{
|
| 84 | 84 |
func (x Options_SandboxIsolation) String() string {
|
| 85 | 85 |
return proto.EnumName(Options_SandboxIsolation_name, int32(x)) |
| 86 | 86 |
} |
| 87 |
+ |
|
| 87 | 88 |
func (Options_SandboxIsolation) EnumDescriptor() ([]byte, []int) {
|
| 88 |
- return fileDescriptorRunhcs, []int{0, 1}
|
|
| 89 |
+ return fileDescriptor_b643df6839c75082, []int{0, 1}
|
|
| 89 | 90 |
} |
| 90 | 91 |
|
| 91 | 92 |
// Options are the set of customizations that can be passed at Create time. |
| ... | ... |
@@ -109,18 +101,49 @@ type Options struct {
|
| 109 | 109 |
SandboxIsolation Options_SandboxIsolation `protobuf:"varint,6,opt,name=sandbox_isolation,json=sandboxIsolation,proto3,enum=containerd.runhcs.v1.Options_SandboxIsolation" json:"sandbox_isolation,omitempty"` |
| 110 | 110 |
// boot_files_root_path is the path to the directory containing the LCOW |
| 111 | 111 |
// kernel and root FS files. |
| 112 |
- BootFilesRootPath string `protobuf:"bytes,7,opt,name=boot_files_root_path,json=bootFilesRootPath,proto3" json:"boot_files_root_path,omitempty"` |
|
| 112 |
+ BootFilesRootPath string `protobuf:"bytes,7,opt,name=boot_files_root_path,json=bootFilesRootPath,proto3" json:"boot_files_root_path,omitempty"` |
|
| 113 |
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
| 114 |
+ XXX_unrecognized []byte `json:"-"` |
|
| 115 |
+ XXX_sizecache int32 `json:"-"` |
|
| 116 |
+} |
|
| 117 |
+ |
|
| 118 |
+func (m *Options) Reset() { *m = Options{} }
|
|
| 119 |
+func (*Options) ProtoMessage() {}
|
|
| 120 |
+func (*Options) Descriptor() ([]byte, []int) {
|
|
| 121 |
+ return fileDescriptor_b643df6839c75082, []int{0}
|
|
| 122 |
+} |
|
| 123 |
+func (m *Options) XXX_Unmarshal(b []byte) error {
|
|
| 124 |
+ return m.Unmarshal(b) |
|
| 125 |
+} |
|
| 126 |
+func (m *Options) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
| 127 |
+ if deterministic {
|
|
| 128 |
+ return xxx_messageInfo_Options.Marshal(b, m, deterministic) |
|
| 129 |
+ } else {
|
|
| 130 |
+ b = b[:cap(b)] |
|
| 131 |
+ n, err := m.MarshalTo(b) |
|
| 132 |
+ if err != nil {
|
|
| 133 |
+ return nil, err |
|
| 134 |
+ } |
|
| 135 |
+ return b[:n], nil |
|
| 136 |
+ } |
|
| 137 |
+} |
|
| 138 |
+func (m *Options) XXX_Merge(src proto.Message) {
|
|
| 139 |
+ xxx_messageInfo_Options.Merge(m, src) |
|
| 140 |
+} |
|
| 141 |
+func (m *Options) XXX_Size() int {
|
|
| 142 |
+ return m.Size() |
|
| 143 |
+} |
|
| 144 |
+func (m *Options) XXX_DiscardUnknown() {
|
|
| 145 |
+ xxx_messageInfo_Options.DiscardUnknown(m) |
|
| 113 | 146 |
} |
| 114 | 147 |
|
| 115 |
-func (m *Options) Reset() { *m = Options{} }
|
|
| 116 |
-func (*Options) ProtoMessage() {}
|
|
| 117 |
-func (*Options) Descriptor() ([]byte, []int) { return fileDescriptorRunhcs, []int{0} }
|
|
| 148 |
+var xxx_messageInfo_Options proto.InternalMessageInfo |
|
| 118 | 149 |
|
| 119 | 150 |
// ProcessDetails contains additional information about a process. This is the additional |
| 120 | 151 |
// info returned in the Pids query. |
| 121 | 152 |
type ProcessDetails struct {
|
| 122 | 153 |
ImageName string `protobuf:"bytes,1,opt,name=image_name,json=imageName,proto3" json:"image_name,omitempty"` |
| 123 |
- CreatedAt time.Time `protobuf:"bytes,2,opt,name=created_at,json=createdAt,stdtime" json:"created_at"` |
|
| 154 |
+ CreatedAt time.Time `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at"` |
|
| 124 | 155 |
KernelTime_100Ns uint64 `protobuf:"varint,3,opt,name=kernel_time_100_ns,json=kernelTime100Ns,proto3" json:"kernel_time_100_ns,omitempty"` |
| 125 | 156 |
MemoryCommitBytes uint64 `protobuf:"varint,4,opt,name=memory_commit_bytes,json=memoryCommitBytes,proto3" json:"memory_commit_bytes,omitempty"` |
| 126 | 157 |
MemoryWorkingSetPrivateBytes uint64 `protobuf:"varint,5,opt,name=memory_working_set_private_bytes,json=memoryWorkingSetPrivateBytes,proto3" json:"memory_working_set_private_bytes,omitempty"` |
| ... | ... |
@@ -128,18 +151,102 @@ type ProcessDetails struct {
|
| 128 | 128 |
ProcessID uint32 `protobuf:"varint,7,opt,name=process_id,json=processId,proto3" json:"process_id,omitempty"` |
| 129 | 129 |
UserTime_100Ns uint64 `protobuf:"varint,8,opt,name=user_time_100_ns,json=userTime100Ns,proto3" json:"user_time_100_ns,omitempty"` |
| 130 | 130 |
ExecID string `protobuf:"bytes,9,opt,name=exec_id,json=execId,proto3" json:"exec_id,omitempty"` |
| 131 |
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
| 132 |
+ XXX_unrecognized []byte `json:"-"` |
|
| 133 |
+ XXX_sizecache int32 `json:"-"` |
|
| 131 | 134 |
} |
| 132 | 135 |
|
| 133 |
-func (m *ProcessDetails) Reset() { *m = ProcessDetails{} }
|
|
| 134 |
-func (*ProcessDetails) ProtoMessage() {}
|
|
| 135 |
-func (*ProcessDetails) Descriptor() ([]byte, []int) { return fileDescriptorRunhcs, []int{1} }
|
|
| 136 |
+func (m *ProcessDetails) Reset() { *m = ProcessDetails{} }
|
|
| 137 |
+func (*ProcessDetails) ProtoMessage() {}
|
|
| 138 |
+func (*ProcessDetails) Descriptor() ([]byte, []int) {
|
|
| 139 |
+ return fileDescriptor_b643df6839c75082, []int{1}
|
|
| 140 |
+} |
|
| 141 |
+func (m *ProcessDetails) XXX_Unmarshal(b []byte) error {
|
|
| 142 |
+ return m.Unmarshal(b) |
|
| 143 |
+} |
|
| 144 |
+func (m *ProcessDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
| 145 |
+ if deterministic {
|
|
| 146 |
+ return xxx_messageInfo_ProcessDetails.Marshal(b, m, deterministic) |
|
| 147 |
+ } else {
|
|
| 148 |
+ b = b[:cap(b)] |
|
| 149 |
+ n, err := m.MarshalTo(b) |
|
| 150 |
+ if err != nil {
|
|
| 151 |
+ return nil, err |
|
| 152 |
+ } |
|
| 153 |
+ return b[:n], nil |
|
| 154 |
+ } |
|
| 155 |
+} |
|
| 156 |
+func (m *ProcessDetails) XXX_Merge(src proto.Message) {
|
|
| 157 |
+ xxx_messageInfo_ProcessDetails.Merge(m, src) |
|
| 158 |
+} |
|
| 159 |
+func (m *ProcessDetails) XXX_Size() int {
|
|
| 160 |
+ return m.Size() |
|
| 161 |
+} |
|
| 162 |
+func (m *ProcessDetails) XXX_DiscardUnknown() {
|
|
| 163 |
+ xxx_messageInfo_ProcessDetails.DiscardUnknown(m) |
|
| 164 |
+} |
|
| 165 |
+ |
|
| 166 |
+var xxx_messageInfo_ProcessDetails proto.InternalMessageInfo |
|
| 136 | 167 |
|
| 137 | 168 |
func init() {
|
| 138 |
- proto.RegisterType((*Options)(nil), "containerd.runhcs.v1.Options") |
|
| 139 |
- proto.RegisterType((*ProcessDetails)(nil), "containerd.runhcs.v1.ProcessDetails") |
|
| 140 | 169 |
proto.RegisterEnum("containerd.runhcs.v1.Options_DebugType", Options_DebugType_name, Options_DebugType_value)
|
| 141 | 170 |
proto.RegisterEnum("containerd.runhcs.v1.Options_SandboxIsolation", Options_SandboxIsolation_name, Options_SandboxIsolation_value)
|
| 171 |
+ proto.RegisterType((*Options)(nil), "containerd.runhcs.v1.Options") |
|
| 172 |
+ proto.RegisterType((*ProcessDetails)(nil), "containerd.runhcs.v1.ProcessDetails") |
|
| 173 |
+} |
|
| 174 |
+ |
|
| 175 |
+func init() {
|
|
| 176 |
+ proto.RegisterFile("github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options/runhcs.proto", fileDescriptor_b643df6839c75082)
|
|
| 142 | 177 |
} |
| 178 |
+ |
|
| 179 |
+var fileDescriptor_b643df6839c75082 = []byte{
|
|
| 180 |
+ // 704 bytes of a gzipped FileDescriptorProto |
|
| 181 |
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x4d, 0x6f, 0xda, 0x48, |
|
| 182 |
+ 0x18, 0xc6, 0xe1, 0xd3, 0x6f, 0x96, 0xc4, 0x99, 0xe5, 0x80, 0xb2, 0xbb, 0x80, 0xc8, 0x21, 0x89, |
|
| 183 |
+ 0x76, 0x63, 0x43, 0xf6, 0xd8, 0x53, 0x09, 0xa0, 0xba, 0x6a, 0x83, 0x65, 0xa2, 0xa6, 0x1f, 0x07, |
|
| 184 |
+ 0xcb, 0xd8, 0x83, 0xb1, 0x82, 0x3d, 0xd6, 0xcc, 0x90, 0x86, 0x5b, 0x7f, 0x42, 0x7f, 0x55, 0x95, |
|
| 185 |
+ 0x63, 0x8f, 0x95, 0x2a, 0xa5, 0x0d, 0xbf, 0xa4, 0x9a, 0xb1, 0x49, 0xd4, 0x28, 0xea, 0xa5, 0x27, |
|
| 186 |
+ 0xc6, 0xcf, 0xf3, 0xbc, 0xcf, 0xfb, 0x29, 0x60, 0x14, 0x84, 0x7c, 0xb6, 0x98, 0xe8, 0x1e, 0x89, |
|
| 187 |
+ 0x8c, 0x97, 0xa1, 0x47, 0x09, 0x23, 0x53, 0x6e, 0xcc, 0x3c, 0xc6, 0x66, 0x61, 0x64, 0x78, 0x91, |
|
| 188 |
+ 0x6f, 0x78, 0x24, 0xe6, 0x6e, 0x18, 0x63, 0xea, 0x1f, 0x09, 0xec, 0x88, 0x2e, 0xe2, 0x99, 0xc7, |
|
| 189 |
+ 0x8e, 0x2e, 0xbb, 0x06, 0x49, 0x78, 0x48, 0x62, 0x66, 0xa4, 0x88, 0x9e, 0x50, 0xc2, 0x09, 0xaa, |
|
| 190 |
+ 0xdd, 0xeb, 0xf5, 0x8c, 0xb8, 0xec, 0xee, 0xd6, 0x02, 0x12, 0x10, 0x29, 0x30, 0xc4, 0x2b, 0xd5, |
|
| 191 |
+ 0xee, 0x36, 0x03, 0x42, 0x82, 0x39, 0x36, 0xe4, 0xd7, 0x64, 0x31, 0x35, 0x78, 0x18, 0x61, 0xc6, |
|
| 192 |
+ 0xdd, 0x28, 0x49, 0x05, 0xed, 0x4f, 0x79, 0x28, 0x8f, 0xd2, 0x2c, 0xa8, 0x06, 0x45, 0x1f, 0x4f, |
|
| 193 |
+ 0x16, 0x41, 0x5d, 0x69, 0x29, 0x07, 0x15, 0x3b, 0xfd, 0x40, 0x43, 0x00, 0xf9, 0x70, 0xf8, 0x32, |
|
| 194 |
+ 0xc1, 0xf5, 0x8d, 0x96, 0x72, 0xb0, 0x75, 0xbc, 0xaf, 0x3f, 0x56, 0x83, 0x9e, 0x19, 0xe9, 0x7d, |
|
| 195 |
+ 0xa1, 0x3f, 0x5b, 0x26, 0xd8, 0x56, 0xfd, 0xf5, 0x13, 0xed, 0x41, 0x95, 0xe2, 0x20, 0x64, 0x9c, |
|
| 196 |
+ 0x2e, 0x1d, 0x4a, 0x08, 0xaf, 0xe7, 0x5b, 0xca, 0x81, 0x6a, 0xff, 0xb1, 0x06, 0x6d, 0x42, 0xb8, |
|
| 197 |
+ 0x10, 0x31, 0x37, 0xf6, 0x27, 0xe4, 0xca, 0x09, 0x23, 0x37, 0xc0, 0xf5, 0x42, 0x2a, 0xca, 0x40, |
|
| 198 |
+ 0x53, 0x60, 0xe8, 0x10, 0xb4, 0xb5, 0x28, 0x99, 0xbb, 0x7c, 0x4a, 0x68, 0x54, 0x2f, 0x4a, 0xdd, |
|
| 199 |
+ 0x76, 0x86, 0x5b, 0x19, 0x8c, 0xde, 0xc1, 0xce, 0x9d, 0x1f, 0x23, 0x73, 0x57, 0xd4, 0x57, 0x2f, |
|
| 200 |
+ 0xc9, 0x1e, 0xf4, 0x5f, 0xf7, 0x30, 0xce, 0x32, 0xae, 0xa3, 0xec, 0x75, 0xce, 0x3b, 0x04, 0x19, |
|
| 201 |
+ 0x50, 0x9b, 0x10, 0xc2, 0x9d, 0x69, 0x38, 0xc7, 0x4c, 0xf6, 0xe4, 0x24, 0x2e, 0x9f, 0xd5, 0xcb, |
|
| 202 |
+ 0xb2, 0x96, 0x1d, 0xc1, 0x0d, 0x05, 0x25, 0x3a, 0xb3, 0x5c, 0x3e, 0x6b, 0x1f, 0x82, 0x7a, 0x37, |
|
| 203 |
+ 0x1a, 0xa4, 0x42, 0xf1, 0xd4, 0x32, 0xad, 0x81, 0x96, 0x43, 0x15, 0x28, 0x0c, 0xcd, 0x17, 0x03, |
|
| 204 |
+ 0x4d, 0x41, 0x65, 0xc8, 0x0f, 0xce, 0xce, 0xb5, 0x8d, 0xb6, 0x01, 0xda, 0xc3, 0x0a, 0xd0, 0x26, |
|
| 205 |
+ 0x94, 0x2d, 0x7b, 0x74, 0x32, 0x18, 0x8f, 0xb5, 0x1c, 0xda, 0x02, 0x78, 0xf6, 0xc6, 0x1a, 0xd8, |
|
| 206 |
+ 0xaf, 0xcc, 0xf1, 0xc8, 0xd6, 0x94, 0xf6, 0xd7, 0x3c, 0x6c, 0x59, 0x94, 0x78, 0x98, 0xb1, 0x3e, |
|
| 207 |
+ 0xe6, 0x6e, 0x38, 0x67, 0xe8, 0x1f, 0x00, 0x39, 0x44, 0x27, 0x76, 0x23, 0x2c, 0x97, 0xaa, 0xda, |
|
| 208 |
+ 0xaa, 0x44, 0x4e, 0xdd, 0x08, 0xa3, 0x13, 0x00, 0x8f, 0x62, 0x97, 0x63, 0xdf, 0x71, 0xb9, 0x5c, |
|
| 209 |
+ 0xec, 0xe6, 0xf1, 0xae, 0x9e, 0x1e, 0x8c, 0xbe, 0x3e, 0x18, 0xfd, 0x6c, 0x7d, 0x30, 0xbd, 0xca, |
|
| 210 |
+ 0xf5, 0x4d, 0x33, 0xf7, 0xf1, 0x5b, 0x53, 0xb1, 0xd5, 0x2c, 0xee, 0x29, 0x47, 0xff, 0x02, 0xba, |
|
| 211 |
+ 0xc0, 0x34, 0xc6, 0x73, 0x47, 0x5c, 0x96, 0xd3, 0xed, 0x74, 0x9c, 0x98, 0xc9, 0xd5, 0x16, 0xec, |
|
| 212 |
+ 0xed, 0x94, 0x11, 0x0e, 0xdd, 0x4e, 0xe7, 0x94, 0x21, 0x1d, 0xfe, 0x8c, 0x70, 0x44, 0xe8, 0xd2, |
|
| 213 |
+ 0xf1, 0x48, 0x14, 0x85, 0xdc, 0x99, 0x2c, 0x39, 0x66, 0x72, 0xc7, 0x05, 0x7b, 0x27, 0xa5, 0x4e, |
|
| 214 |
+ 0x24, 0xd3, 0x13, 0x04, 0x1a, 0x42, 0x2b, 0xd3, 0xbf, 0x27, 0xf4, 0x22, 0x8c, 0x03, 0x87, 0x61, |
|
| 215 |
+ 0xee, 0x24, 0x34, 0xbc, 0x74, 0x39, 0xce, 0x82, 0x8b, 0x32, 0xf8, 0xef, 0x54, 0x77, 0x9e, 0xca, |
|
| 216 |
+ 0xc6, 0x98, 0x5b, 0xa9, 0x28, 0xf5, 0xe9, 0x43, 0xf3, 0x11, 0x1f, 0x36, 0x73, 0x29, 0xf6, 0x33, |
|
| 217 |
+ 0x9b, 0x92, 0xb4, 0xf9, 0xeb, 0xa1, 0xcd, 0x58, 0x6a, 0x52, 0x97, 0xff, 0x00, 0x92, 0x74, 0xc0, |
|
| 218 |
+ 0x4e, 0xe8, 0xcb, 0x25, 0x57, 0x7b, 0xd5, 0xd5, 0x4d, 0x53, 0xcd, 0xc6, 0x6e, 0xf6, 0x6d, 0x35, |
|
| 219 |
+ 0x13, 0x98, 0x3e, 0xda, 0x07, 0x6d, 0xc1, 0x30, 0xfd, 0x69, 0x2c, 0x15, 0x99, 0xa4, 0x2a, 0xf0, |
|
| 220 |
+ 0xfb, 0xa1, 0xec, 0x41, 0x19, 0x5f, 0x61, 0x4f, 0x78, 0xaa, 0x62, 0x45, 0x3d, 0x58, 0xdd, 0x34, |
|
| 221 |
+ 0x4b, 0x83, 0x2b, 0xec, 0x99, 0x7d, 0xbb, 0x24, 0x28, 0xd3, 0xef, 0xf9, 0xd7, 0xb7, 0x8d, 0xdc, |
|
| 222 |
+ 0x97, 0xdb, 0x46, 0xee, 0xc3, 0xaa, 0xa1, 0x5c, 0xaf, 0x1a, 0xca, 0xe7, 0x55, 0x43, 0xf9, 0xbe, |
|
| 223 |
+ 0x6a, 0x28, 0x6f, 0x9f, 0xff, 0xfe, 0xdf, 0xcb, 0x93, 0xec, 0xf7, 0x75, 0x6e, 0x52, 0x92, 0x7b, |
|
| 224 |
+ 0xff, 0xff, 0x47, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa3, 0x9a, 0x54, 0x17, 0xb5, 0x04, 0x00, 0x00, |
|
| 225 |
+} |
|
| 226 |
+ |
|
| 143 | 227 |
func (m *Options) Marshal() (dAtA []byte, err error) {
|
| 144 | 228 |
size := m.Size() |
| 145 | 229 |
dAtA = make([]byte, size) |
| ... | ... |
@@ -199,6 +306,9 @@ func (m *Options) MarshalTo(dAtA []byte) (int, error) {
|
| 199 | 199 |
i = encodeVarintRunhcs(dAtA, i, uint64(len(m.BootFilesRootPath))) |
| 200 | 200 |
i += copy(dAtA[i:], m.BootFilesRootPath) |
| 201 | 201 |
} |
| 202 |
+ if m.XXX_unrecognized != nil {
|
|
| 203 |
+ i += copy(dAtA[i:], m.XXX_unrecognized) |
|
| 204 |
+ } |
|
| 202 | 205 |
return i, nil |
| 203 | 206 |
} |
| 204 | 207 |
|
| ... | ... |
@@ -225,8 +335,8 @@ func (m *ProcessDetails) MarshalTo(dAtA []byte) (int, error) {
|
| 225 | 225 |
} |
| 226 | 226 |
dAtA[i] = 0x12 |
| 227 | 227 |
i++ |
| 228 |
- i = encodeVarintRunhcs(dAtA, i, uint64(types.SizeOfStdTime(m.CreatedAt))) |
|
| 229 |
- n1, err := types.StdTimeMarshalTo(m.CreatedAt, dAtA[i:]) |
|
| 228 |
+ i = encodeVarintRunhcs(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt))) |
|
| 229 |
+ n1, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreatedAt, dAtA[i:]) |
|
| 230 | 230 |
if err != nil {
|
| 231 | 231 |
return 0, err |
| 232 | 232 |
} |
| ... | ... |
@@ -267,6 +377,9 @@ func (m *ProcessDetails) MarshalTo(dAtA []byte) (int, error) {
|
| 267 | 267 |
i = encodeVarintRunhcs(dAtA, i, uint64(len(m.ExecID))) |
| 268 | 268 |
i += copy(dAtA[i:], m.ExecID) |
| 269 | 269 |
} |
| 270 |
+ if m.XXX_unrecognized != nil {
|
|
| 271 |
+ i += copy(dAtA[i:], m.XXX_unrecognized) |
|
| 272 |
+ } |
|
| 270 | 273 |
return i, nil |
| 271 | 274 |
} |
| 272 | 275 |
|
| ... | ... |
@@ -280,6 +393,9 @@ func encodeVarintRunhcs(dAtA []byte, offset int, v uint64) int {
|
| 280 | 280 |
return offset + 1 |
| 281 | 281 |
} |
| 282 | 282 |
func (m *Options) Size() (n int) {
|
| 283 |
+ if m == nil {
|
|
| 284 |
+ return 0 |
|
| 285 |
+ } |
|
| 283 | 286 |
var l int |
| 284 | 287 |
_ = l |
| 285 | 288 |
if m.Debug {
|
| ... | ... |
@@ -307,17 +423,23 @@ func (m *Options) Size() (n int) {
|
| 307 | 307 |
if l > 0 {
|
| 308 | 308 |
n += 1 + l + sovRunhcs(uint64(l)) |
| 309 | 309 |
} |
| 310 |
+ if m.XXX_unrecognized != nil {
|
|
| 311 |
+ n += len(m.XXX_unrecognized) |
|
| 312 |
+ } |
|
| 310 | 313 |
return n |
| 311 | 314 |
} |
| 312 | 315 |
|
| 313 | 316 |
func (m *ProcessDetails) Size() (n int) {
|
| 317 |
+ if m == nil {
|
|
| 318 |
+ return 0 |
|
| 319 |
+ } |
|
| 314 | 320 |
var l int |
| 315 | 321 |
_ = l |
| 316 | 322 |
l = len(m.ImageName) |
| 317 | 323 |
if l > 0 {
|
| 318 | 324 |
n += 1 + l + sovRunhcs(uint64(l)) |
| 319 | 325 |
} |
| 320 |
- l = types.SizeOfStdTime(m.CreatedAt) |
|
| 326 |
+ l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt) |
|
| 321 | 327 |
n += 1 + l + sovRunhcs(uint64(l)) |
| 322 | 328 |
if m.KernelTime_100Ns != 0 {
|
| 323 | 329 |
n += 1 + sovRunhcs(uint64(m.KernelTime_100Ns)) |
| ... | ... |
@@ -341,6 +463,9 @@ func (m *ProcessDetails) Size() (n int) {
|
| 341 | 341 |
if l > 0 {
|
| 342 | 342 |
n += 1 + l + sovRunhcs(uint64(l)) |
| 343 | 343 |
} |
| 344 |
+ if m.XXX_unrecognized != nil {
|
|
| 345 |
+ n += len(m.XXX_unrecognized) |
|
| 346 |
+ } |
|
| 344 | 347 |
return n |
| 345 | 348 |
} |
| 346 | 349 |
|
| ... | ... |
@@ -369,6 +494,7 @@ func (this *Options) String() string {
|
| 369 | 369 |
`SandboxPlatform:` + fmt.Sprintf("%v", this.SandboxPlatform) + `,`,
|
| 370 | 370 |
`SandboxIsolation:` + fmt.Sprintf("%v", this.SandboxIsolation) + `,`,
|
| 371 | 371 |
`BootFilesRootPath:` + fmt.Sprintf("%v", this.BootFilesRootPath) + `,`,
|
| 372 |
+ `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
|
|
| 372 | 373 |
`}`, |
| 373 | 374 |
}, "") |
| 374 | 375 |
return s |
| ... | ... |
@@ -379,7 +505,7 @@ func (this *ProcessDetails) String() string {
|
| 379 | 379 |
} |
| 380 | 380 |
s := strings.Join([]string{`&ProcessDetails{`,
|
| 381 | 381 |
`ImageName:` + fmt.Sprintf("%v", this.ImageName) + `,`,
|
| 382 |
- `CreatedAt:` + strings.Replace(strings.Replace(this.CreatedAt.String(), "Timestamp", "google_protobuf1.Timestamp", 1), `&`, ``, 1) + `,`, |
|
| 382 |
+ `CreatedAt:` + strings.Replace(strings.Replace(this.CreatedAt.String(), "Timestamp", "types.Timestamp", 1), `&`, ``, 1) + `,`, |
|
| 383 | 383 |
`KernelTime_100Ns:` + fmt.Sprintf("%v", this.KernelTime_100Ns) + `,`,
|
| 384 | 384 |
`MemoryCommitBytes:` + fmt.Sprintf("%v", this.MemoryCommitBytes) + `,`,
|
| 385 | 385 |
`MemoryWorkingSetPrivateBytes:` + fmt.Sprintf("%v", this.MemoryWorkingSetPrivateBytes) + `,`,
|
| ... | ... |
@@ -387,6 +513,7 @@ func (this *ProcessDetails) String() string {
|
| 387 | 387 |
`ProcessID:` + fmt.Sprintf("%v", this.ProcessID) + `,`,
|
| 388 | 388 |
`UserTime_100Ns:` + fmt.Sprintf("%v", this.UserTime_100Ns) + `,`,
|
| 389 | 389 |
`ExecID:` + fmt.Sprintf("%v", this.ExecID) + `,`,
|
| 390 |
+ `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
|
|
| 390 | 391 |
`}`, |
| 391 | 392 |
}, "") |
| 392 | 393 |
return s |
| ... | ... |
@@ -414,7 +541,7 @@ func (m *Options) Unmarshal(dAtA []byte) error {
|
| 414 | 414 |
} |
| 415 | 415 |
b := dAtA[iNdEx] |
| 416 | 416 |
iNdEx++ |
| 417 |
- wire |= (uint64(b) & 0x7F) << shift |
|
| 417 |
+ wire |= uint64(b&0x7F) << shift |
|
| 418 | 418 |
if b < 0x80 {
|
| 419 | 419 |
break |
| 420 | 420 |
} |
| ... | ... |
@@ -442,7 +569,7 @@ func (m *Options) Unmarshal(dAtA []byte) error {
|
| 442 | 442 |
} |
| 443 | 443 |
b := dAtA[iNdEx] |
| 444 | 444 |
iNdEx++ |
| 445 |
- v |= (int(b) & 0x7F) << shift |
|
| 445 |
+ v |= int(b&0x7F) << shift |
|
| 446 | 446 |
if b < 0x80 {
|
| 447 | 447 |
break |
| 448 | 448 |
} |
| ... | ... |
@@ -462,7 +589,7 @@ func (m *Options) Unmarshal(dAtA []byte) error {
|
| 462 | 462 |
} |
| 463 | 463 |
b := dAtA[iNdEx] |
| 464 | 464 |
iNdEx++ |
| 465 |
- m.DebugType |= (Options_DebugType(b) & 0x7F) << shift |
|
| 465 |
+ m.DebugType |= Options_DebugType(b&0x7F) << shift |
|
| 466 | 466 |
if b < 0x80 {
|
| 467 | 467 |
break |
| 468 | 468 |
} |
| ... | ... |
@@ -481,7 +608,7 @@ func (m *Options) Unmarshal(dAtA []byte) error {
|
| 481 | 481 |
} |
| 482 | 482 |
b := dAtA[iNdEx] |
| 483 | 483 |
iNdEx++ |
| 484 |
- stringLen |= (uint64(b) & 0x7F) << shift |
|
| 484 |
+ stringLen |= uint64(b&0x7F) << shift |
|
| 485 | 485 |
if b < 0x80 {
|
| 486 | 486 |
break |
| 487 | 487 |
} |
| ... | ... |
@@ -491,6 +618,9 @@ func (m *Options) Unmarshal(dAtA []byte) error {
|
| 491 | 491 |
return ErrInvalidLengthRunhcs |
| 492 | 492 |
} |
| 493 | 493 |
postIndex := iNdEx + intStringLen |
| 494 |
+ if postIndex < 0 {
|
|
| 495 |
+ return ErrInvalidLengthRunhcs |
|
| 496 |
+ } |
|
| 494 | 497 |
if postIndex > l {
|
| 495 | 498 |
return io.ErrUnexpectedEOF |
| 496 | 499 |
} |
| ... | ... |
@@ -510,7 +640,7 @@ func (m *Options) Unmarshal(dAtA []byte) error {
|
| 510 | 510 |
} |
| 511 | 511 |
b := dAtA[iNdEx] |
| 512 | 512 |
iNdEx++ |
| 513 |
- stringLen |= (uint64(b) & 0x7F) << shift |
|
| 513 |
+ stringLen |= uint64(b&0x7F) << shift |
|
| 514 | 514 |
if b < 0x80 {
|
| 515 | 515 |
break |
| 516 | 516 |
} |
| ... | ... |
@@ -520,6 +650,9 @@ func (m *Options) Unmarshal(dAtA []byte) error {
|
| 520 | 520 |
return ErrInvalidLengthRunhcs |
| 521 | 521 |
} |
| 522 | 522 |
postIndex := iNdEx + intStringLen |
| 523 |
+ if postIndex < 0 {
|
|
| 524 |
+ return ErrInvalidLengthRunhcs |
|
| 525 |
+ } |
|
| 523 | 526 |
if postIndex > l {
|
| 524 | 527 |
return io.ErrUnexpectedEOF |
| 525 | 528 |
} |
| ... | ... |
@@ -539,7 +672,7 @@ func (m *Options) Unmarshal(dAtA []byte) error {
|
| 539 | 539 |
} |
| 540 | 540 |
b := dAtA[iNdEx] |
| 541 | 541 |
iNdEx++ |
| 542 |
- stringLen |= (uint64(b) & 0x7F) << shift |
|
| 542 |
+ stringLen |= uint64(b&0x7F) << shift |
|
| 543 | 543 |
if b < 0x80 {
|
| 544 | 544 |
break |
| 545 | 545 |
} |
| ... | ... |
@@ -549,6 +682,9 @@ func (m *Options) Unmarshal(dAtA []byte) error {
|
| 549 | 549 |
return ErrInvalidLengthRunhcs |
| 550 | 550 |
} |
| 551 | 551 |
postIndex := iNdEx + intStringLen |
| 552 |
+ if postIndex < 0 {
|
|
| 553 |
+ return ErrInvalidLengthRunhcs |
|
| 554 |
+ } |
|
| 552 | 555 |
if postIndex > l {
|
| 553 | 556 |
return io.ErrUnexpectedEOF |
| 554 | 557 |
} |
| ... | ... |
@@ -568,7 +704,7 @@ func (m *Options) Unmarshal(dAtA []byte) error {
|
| 568 | 568 |
} |
| 569 | 569 |
b := dAtA[iNdEx] |
| 570 | 570 |
iNdEx++ |
| 571 |
- m.SandboxIsolation |= (Options_SandboxIsolation(b) & 0x7F) << shift |
|
| 571 |
+ m.SandboxIsolation |= Options_SandboxIsolation(b&0x7F) << shift |
|
| 572 | 572 |
if b < 0x80 {
|
| 573 | 573 |
break |
| 574 | 574 |
} |
| ... | ... |
@@ -587,7 +723,7 @@ func (m *Options) Unmarshal(dAtA []byte) error {
|
| 587 | 587 |
} |
| 588 | 588 |
b := dAtA[iNdEx] |
| 589 | 589 |
iNdEx++ |
| 590 |
- stringLen |= (uint64(b) & 0x7F) << shift |
|
| 590 |
+ stringLen |= uint64(b&0x7F) << shift |
|
| 591 | 591 |
if b < 0x80 {
|
| 592 | 592 |
break |
| 593 | 593 |
} |
| ... | ... |
@@ -597,6 +733,9 @@ func (m *Options) Unmarshal(dAtA []byte) error {
|
| 597 | 597 |
return ErrInvalidLengthRunhcs |
| 598 | 598 |
} |
| 599 | 599 |
postIndex := iNdEx + intStringLen |
| 600 |
+ if postIndex < 0 {
|
|
| 601 |
+ return ErrInvalidLengthRunhcs |
|
| 602 |
+ } |
|
| 600 | 603 |
if postIndex > l {
|
| 601 | 604 |
return io.ErrUnexpectedEOF |
| 602 | 605 |
} |
| ... | ... |
@@ -611,9 +750,13 @@ func (m *Options) Unmarshal(dAtA []byte) error {
|
| 611 | 611 |
if skippy < 0 {
|
| 612 | 612 |
return ErrInvalidLengthRunhcs |
| 613 | 613 |
} |
| 614 |
+ if (iNdEx + skippy) < 0 {
|
|
| 615 |
+ return ErrInvalidLengthRunhcs |
|
| 616 |
+ } |
|
| 614 | 617 |
if (iNdEx + skippy) > l {
|
| 615 | 618 |
return io.ErrUnexpectedEOF |
| 616 | 619 |
} |
| 620 |
+ m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) |
|
| 617 | 621 |
iNdEx += skippy |
| 618 | 622 |
} |
| 619 | 623 |
} |
| ... | ... |
@@ -638,7 +781,7 @@ func (m *ProcessDetails) Unmarshal(dAtA []byte) error {
|
| 638 | 638 |
} |
| 639 | 639 |
b := dAtA[iNdEx] |
| 640 | 640 |
iNdEx++ |
| 641 |
- wire |= (uint64(b) & 0x7F) << shift |
|
| 641 |
+ wire |= uint64(b&0x7F) << shift |
|
| 642 | 642 |
if b < 0x80 {
|
| 643 | 643 |
break |
| 644 | 644 |
} |
| ... | ... |
@@ -666,7 +809,7 @@ func (m *ProcessDetails) Unmarshal(dAtA []byte) error {
|
| 666 | 666 |
} |
| 667 | 667 |
b := dAtA[iNdEx] |
| 668 | 668 |
iNdEx++ |
| 669 |
- stringLen |= (uint64(b) & 0x7F) << shift |
|
| 669 |
+ stringLen |= uint64(b&0x7F) << shift |
|
| 670 | 670 |
if b < 0x80 {
|
| 671 | 671 |
break |
| 672 | 672 |
} |
| ... | ... |
@@ -676,6 +819,9 @@ func (m *ProcessDetails) Unmarshal(dAtA []byte) error {
|
| 676 | 676 |
return ErrInvalidLengthRunhcs |
| 677 | 677 |
} |
| 678 | 678 |
postIndex := iNdEx + intStringLen |
| 679 |
+ if postIndex < 0 {
|
|
| 680 |
+ return ErrInvalidLengthRunhcs |
|
| 681 |
+ } |
|
| 679 | 682 |
if postIndex > l {
|
| 680 | 683 |
return io.ErrUnexpectedEOF |
| 681 | 684 |
} |
| ... | ... |
@@ -695,7 +841,7 @@ func (m *ProcessDetails) Unmarshal(dAtA []byte) error {
|
| 695 | 695 |
} |
| 696 | 696 |
b := dAtA[iNdEx] |
| 697 | 697 |
iNdEx++ |
| 698 |
- msglen |= (int(b) & 0x7F) << shift |
|
| 698 |
+ msglen |= int(b&0x7F) << shift |
|
| 699 | 699 |
if b < 0x80 {
|
| 700 | 700 |
break |
| 701 | 701 |
} |
| ... | ... |
@@ -704,10 +850,13 @@ func (m *ProcessDetails) Unmarshal(dAtA []byte) error {
|
| 704 | 704 |
return ErrInvalidLengthRunhcs |
| 705 | 705 |
} |
| 706 | 706 |
postIndex := iNdEx + msglen |
| 707 |
+ if postIndex < 0 {
|
|
| 708 |
+ return ErrInvalidLengthRunhcs |
|
| 709 |
+ } |
|
| 707 | 710 |
if postIndex > l {
|
| 708 | 711 |
return io.ErrUnexpectedEOF |
| 709 | 712 |
} |
| 710 |
- if err := types.StdTimeUnmarshal(&m.CreatedAt, dAtA[iNdEx:postIndex]); err != nil {
|
|
| 713 |
+ if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CreatedAt, dAtA[iNdEx:postIndex]); err != nil {
|
|
| 711 | 714 |
return err |
| 712 | 715 |
} |
| 713 | 716 |
iNdEx = postIndex |
| ... | ... |
@@ -725,7 +874,7 @@ func (m *ProcessDetails) Unmarshal(dAtA []byte) error {
|
| 725 | 725 |
} |
| 726 | 726 |
b := dAtA[iNdEx] |
| 727 | 727 |
iNdEx++ |
| 728 |
- m.KernelTime_100Ns |= (uint64(b) & 0x7F) << shift |
|
| 728 |
+ m.KernelTime_100Ns |= uint64(b&0x7F) << shift |
|
| 729 | 729 |
if b < 0x80 {
|
| 730 | 730 |
break |
| 731 | 731 |
} |
| ... | ... |
@@ -744,7 +893,7 @@ func (m *ProcessDetails) Unmarshal(dAtA []byte) error {
|
| 744 | 744 |
} |
| 745 | 745 |
b := dAtA[iNdEx] |
| 746 | 746 |
iNdEx++ |
| 747 |
- m.MemoryCommitBytes |= (uint64(b) & 0x7F) << shift |
|
| 747 |
+ m.MemoryCommitBytes |= uint64(b&0x7F) << shift |
|
| 748 | 748 |
if b < 0x80 {
|
| 749 | 749 |
break |
| 750 | 750 |
} |
| ... | ... |
@@ -763,7 +912,7 @@ func (m *ProcessDetails) Unmarshal(dAtA []byte) error {
|
| 763 | 763 |
} |
| 764 | 764 |
b := dAtA[iNdEx] |
| 765 | 765 |
iNdEx++ |
| 766 |
- m.MemoryWorkingSetPrivateBytes |= (uint64(b) & 0x7F) << shift |
|
| 766 |
+ m.MemoryWorkingSetPrivateBytes |= uint64(b&0x7F) << shift |
|
| 767 | 767 |
if b < 0x80 {
|
| 768 | 768 |
break |
| 769 | 769 |
} |
| ... | ... |
@@ -782,7 +931,7 @@ func (m *ProcessDetails) Unmarshal(dAtA []byte) error {
|
| 782 | 782 |
} |
| 783 | 783 |
b := dAtA[iNdEx] |
| 784 | 784 |
iNdEx++ |
| 785 |
- m.MemoryWorkingSetSharedBytes |= (uint64(b) & 0x7F) << shift |
|
| 785 |
+ m.MemoryWorkingSetSharedBytes |= uint64(b&0x7F) << shift |
|
| 786 | 786 |
if b < 0x80 {
|
| 787 | 787 |
break |
| 788 | 788 |
} |
| ... | ... |
@@ -801,7 +950,7 @@ func (m *ProcessDetails) Unmarshal(dAtA []byte) error {
|
| 801 | 801 |
} |
| 802 | 802 |
b := dAtA[iNdEx] |
| 803 | 803 |
iNdEx++ |
| 804 |
- m.ProcessID |= (uint32(b) & 0x7F) << shift |
|
| 804 |
+ m.ProcessID |= uint32(b&0x7F) << shift |
|
| 805 | 805 |
if b < 0x80 {
|
| 806 | 806 |
break |
| 807 | 807 |
} |
| ... | ... |
@@ -820,7 +969,7 @@ func (m *ProcessDetails) Unmarshal(dAtA []byte) error {
|
| 820 | 820 |
} |
| 821 | 821 |
b := dAtA[iNdEx] |
| 822 | 822 |
iNdEx++ |
| 823 |
- m.UserTime_100Ns |= (uint64(b) & 0x7F) << shift |
|
| 823 |
+ m.UserTime_100Ns |= uint64(b&0x7F) << shift |
|
| 824 | 824 |
if b < 0x80 {
|
| 825 | 825 |
break |
| 826 | 826 |
} |
| ... | ... |
@@ -839,7 +988,7 @@ func (m *ProcessDetails) Unmarshal(dAtA []byte) error {
|
| 839 | 839 |
} |
| 840 | 840 |
b := dAtA[iNdEx] |
| 841 | 841 |
iNdEx++ |
| 842 |
- stringLen |= (uint64(b) & 0x7F) << shift |
|
| 842 |
+ stringLen |= uint64(b&0x7F) << shift |
|
| 843 | 843 |
if b < 0x80 {
|
| 844 | 844 |
break |
| 845 | 845 |
} |
| ... | ... |
@@ -849,6 +998,9 @@ func (m *ProcessDetails) Unmarshal(dAtA []byte) error {
|
| 849 | 849 |
return ErrInvalidLengthRunhcs |
| 850 | 850 |
} |
| 851 | 851 |
postIndex := iNdEx + intStringLen |
| 852 |
+ if postIndex < 0 {
|
|
| 853 |
+ return ErrInvalidLengthRunhcs |
|
| 854 |
+ } |
|
| 852 | 855 |
if postIndex > l {
|
| 853 | 856 |
return io.ErrUnexpectedEOF |
| 854 | 857 |
} |
| ... | ... |
@@ -863,9 +1015,13 @@ func (m *ProcessDetails) Unmarshal(dAtA []byte) error {
|
| 863 | 863 |
if skippy < 0 {
|
| 864 | 864 |
return ErrInvalidLengthRunhcs |
| 865 | 865 |
} |
| 866 |
+ if (iNdEx + skippy) < 0 {
|
|
| 867 |
+ return ErrInvalidLengthRunhcs |
|
| 868 |
+ } |
|
| 866 | 869 |
if (iNdEx + skippy) > l {
|
| 867 | 870 |
return io.ErrUnexpectedEOF |
| 868 | 871 |
} |
| 872 |
+ m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) |
|
| 869 | 873 |
iNdEx += skippy |
| 870 | 874 |
} |
| 871 | 875 |
} |
| ... | ... |
@@ -929,10 +1085,13 @@ func skipRunhcs(dAtA []byte) (n int, err error) {
|
| 929 | 929 |
break |
| 930 | 930 |
} |
| 931 | 931 |
} |
| 932 |
- iNdEx += length |
|
| 933 | 932 |
if length < 0 {
|
| 934 | 933 |
return 0, ErrInvalidLengthRunhcs |
| 935 | 934 |
} |
| 935 |
+ iNdEx += length |
|
| 936 |
+ if iNdEx < 0 {
|
|
| 937 |
+ return 0, ErrInvalidLengthRunhcs |
|
| 938 |
+ } |
|
| 936 | 939 |
return iNdEx, nil |
| 937 | 940 |
case 3: |
| 938 | 941 |
for {
|
| ... | ... |
@@ -961,6 +1120,9 @@ func skipRunhcs(dAtA []byte) (n int, err error) {
|
| 961 | 961 |
return 0, err |
| 962 | 962 |
} |
| 963 | 963 |
iNdEx = start + next |
| 964 |
+ if iNdEx < 0 {
|
|
| 965 |
+ return 0, ErrInvalidLengthRunhcs |
|
| 966 |
+ } |
|
| 964 | 967 |
} |
| 965 | 968 |
return iNdEx, nil |
| 966 | 969 |
case 4: |
| ... | ... |
@@ -979,55 +1141,3 @@ var ( |
| 979 | 979 |
ErrInvalidLengthRunhcs = fmt.Errorf("proto: negative length found during unmarshaling")
|
| 980 | 980 |
ErrIntOverflowRunhcs = fmt.Errorf("proto: integer overflow")
|
| 981 | 981 |
) |
| 982 |
- |
|
| 983 |
-func init() {
|
|
| 984 |
- proto.RegisterFile("github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options/runhcs.proto", fileDescriptorRunhcs)
|
|
| 985 |
-} |
|
| 986 |
- |
|
| 987 |
-var fileDescriptorRunhcs = []byte{
|
|
| 988 |
- // 704 bytes of a gzipped FileDescriptorProto |
|
| 989 |
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x4d, 0x6f, 0xda, 0x48, |
|
| 990 |
- 0x18, 0xc6, 0xe1, 0xd3, 0x6f, 0x96, 0xc4, 0x99, 0xe5, 0x80, 0xb2, 0xbb, 0x80, 0xc8, 0x21, 0x89, |
|
| 991 |
- 0x76, 0x63, 0x43, 0xf6, 0xd8, 0x53, 0x09, 0xa0, 0xba, 0x6a, 0x83, 0x65, 0xa2, 0xa6, 0x1f, 0x07, |
|
| 992 |
- 0xcb, 0xd8, 0x83, 0xb1, 0x82, 0x3d, 0xd6, 0xcc, 0x90, 0x86, 0x5b, 0x7f, 0x42, 0x7f, 0x55, 0x95, |
|
| 993 |
- 0x63, 0x8f, 0x95, 0x2a, 0xa5, 0x0d, 0xbf, 0xa4, 0x9a, 0xb1, 0x49, 0xd4, 0x28, 0xea, 0xa5, 0x27, |
|
| 994 |
- 0xc6, 0xcf, 0xf3, 0xbc, 0xcf, 0xfb, 0x29, 0x60, 0x14, 0x84, 0x7c, 0xb6, 0x98, 0xe8, 0x1e, 0x89, |
|
| 995 |
- 0x8c, 0x97, 0xa1, 0x47, 0x09, 0x23, 0x53, 0x6e, 0xcc, 0x3c, 0xc6, 0x66, 0x61, 0x64, 0x78, 0x91, |
|
| 996 |
- 0x6f, 0x78, 0x24, 0xe6, 0x6e, 0x18, 0x63, 0xea, 0x1f, 0x09, 0xec, 0x88, 0x2e, 0xe2, 0x99, 0xc7, |
|
| 997 |
- 0x8e, 0x2e, 0xbb, 0x06, 0x49, 0x78, 0x48, 0x62, 0x66, 0xa4, 0x88, 0x9e, 0x50, 0xc2, 0x09, 0xaa, |
|
| 998 |
- 0xdd, 0xeb, 0xf5, 0x8c, 0xb8, 0xec, 0xee, 0xd6, 0x02, 0x12, 0x10, 0x29, 0x30, 0xc4, 0x2b, 0xd5, |
|
| 999 |
- 0xee, 0x36, 0x03, 0x42, 0x82, 0x39, 0x36, 0xe4, 0xd7, 0x64, 0x31, 0x35, 0x78, 0x18, 0x61, 0xc6, |
|
| 1000 |
- 0xdd, 0x28, 0x49, 0x05, 0xed, 0x4f, 0x79, 0x28, 0x8f, 0xd2, 0x2c, 0xa8, 0x06, 0x45, 0x1f, 0x4f, |
|
| 1001 |
- 0x16, 0x41, 0x5d, 0x69, 0x29, 0x07, 0x15, 0x3b, 0xfd, 0x40, 0x43, 0x00, 0xf9, 0x70, 0xf8, 0x32, |
|
| 1002 |
- 0xc1, 0xf5, 0x8d, 0x96, 0x72, 0xb0, 0x75, 0xbc, 0xaf, 0x3f, 0x56, 0x83, 0x9e, 0x19, 0xe9, 0x7d, |
|
| 1003 |
- 0xa1, 0x3f, 0x5b, 0x26, 0xd8, 0x56, 0xfd, 0xf5, 0x13, 0xed, 0x41, 0x95, 0xe2, 0x20, 0x64, 0x9c, |
|
| 1004 |
- 0x2e, 0x1d, 0x4a, 0x08, 0xaf, 0xe7, 0x5b, 0xca, 0x81, 0x6a, 0xff, 0xb1, 0x06, 0x6d, 0x42, 0xb8, |
|
| 1005 |
- 0x10, 0x31, 0x37, 0xf6, 0x27, 0xe4, 0xca, 0x09, 0x23, 0x37, 0xc0, 0xf5, 0x42, 0x2a, 0xca, 0x40, |
|
| 1006 |
- 0x53, 0x60, 0xe8, 0x10, 0xb4, 0xb5, 0x28, 0x99, 0xbb, 0x7c, 0x4a, 0x68, 0x54, 0x2f, 0x4a, 0xdd, |
|
| 1007 |
- 0x76, 0x86, 0x5b, 0x19, 0x8c, 0xde, 0xc1, 0xce, 0x9d, 0x1f, 0x23, 0x73, 0x57, 0xd4, 0x57, 0x2f, |
|
| 1008 |
- 0xc9, 0x1e, 0xf4, 0x5f, 0xf7, 0x30, 0xce, 0x32, 0xae, 0xa3, 0xec, 0x75, 0xce, 0x3b, 0x04, 0x19, |
|
| 1009 |
- 0x50, 0x9b, 0x10, 0xc2, 0x9d, 0x69, 0x38, 0xc7, 0x4c, 0xf6, 0xe4, 0x24, 0x2e, 0x9f, 0xd5, 0xcb, |
|
| 1010 |
- 0xb2, 0x96, 0x1d, 0xc1, 0x0d, 0x05, 0x25, 0x3a, 0xb3, 0x5c, 0x3e, 0x6b, 0x1f, 0x82, 0x7a, 0x37, |
|
| 1011 |
- 0x1a, 0xa4, 0x42, 0xf1, 0xd4, 0x32, 0xad, 0x81, 0x96, 0x43, 0x15, 0x28, 0x0c, 0xcd, 0x17, 0x03, |
|
| 1012 |
- 0x4d, 0x41, 0x65, 0xc8, 0x0f, 0xce, 0xce, 0xb5, 0x8d, 0xb6, 0x01, 0xda, 0xc3, 0x0a, 0xd0, 0x26, |
|
| 1013 |
- 0x94, 0x2d, 0x7b, 0x74, 0x32, 0x18, 0x8f, 0xb5, 0x1c, 0xda, 0x02, 0x78, 0xf6, 0xc6, 0x1a, 0xd8, |
|
| 1014 |
- 0xaf, 0xcc, 0xf1, 0xc8, 0xd6, 0x94, 0xf6, 0xd7, 0x3c, 0x6c, 0x59, 0x94, 0x78, 0x98, 0xb1, 0x3e, |
|
| 1015 |
- 0xe6, 0x6e, 0x38, 0x67, 0xe8, 0x1f, 0x00, 0x39, 0x44, 0x27, 0x76, 0x23, 0x2c, 0x97, 0xaa, 0xda, |
|
| 1016 |
- 0xaa, 0x44, 0x4e, 0xdd, 0x08, 0xa3, 0x13, 0x00, 0x8f, 0x62, 0x97, 0x63, 0xdf, 0x71, 0xb9, 0x5c, |
|
| 1017 |
- 0xec, 0xe6, 0xf1, 0xae, 0x9e, 0x1e, 0x8c, 0xbe, 0x3e, 0x18, 0xfd, 0x6c, 0x7d, 0x30, 0xbd, 0xca, |
|
| 1018 |
- 0xf5, 0x4d, 0x33, 0xf7, 0xf1, 0x5b, 0x53, 0xb1, 0xd5, 0x2c, 0xee, 0x29, 0x47, 0xff, 0x02, 0xba, |
|
| 1019 |
- 0xc0, 0x34, 0xc6, 0x73, 0x47, 0x5c, 0x96, 0xd3, 0xed, 0x74, 0x9c, 0x98, 0xc9, 0xd5, 0x16, 0xec, |
|
| 1020 |
- 0xed, 0x94, 0x11, 0x0e, 0xdd, 0x4e, 0xe7, 0x94, 0x21, 0x1d, 0xfe, 0x8c, 0x70, 0x44, 0xe8, 0xd2, |
|
| 1021 |
- 0xf1, 0x48, 0x14, 0x85, 0xdc, 0x99, 0x2c, 0x39, 0x66, 0x72, 0xc7, 0x05, 0x7b, 0x27, 0xa5, 0x4e, |
|
| 1022 |
- 0x24, 0xd3, 0x13, 0x04, 0x1a, 0x42, 0x2b, 0xd3, 0xbf, 0x27, 0xf4, 0x22, 0x8c, 0x03, 0x87, 0x61, |
|
| 1023 |
- 0xee, 0x24, 0x34, 0xbc, 0x74, 0x39, 0xce, 0x82, 0x8b, 0x32, 0xf8, 0xef, 0x54, 0x77, 0x9e, 0xca, |
|
| 1024 |
- 0xc6, 0x98, 0x5b, 0xa9, 0x28, 0xf5, 0xe9, 0x43, 0xf3, 0x11, 0x1f, 0x36, 0x73, 0x29, 0xf6, 0x33, |
|
| 1025 |
- 0x9b, 0x92, 0xb4, 0xf9, 0xeb, 0xa1, 0xcd, 0x58, 0x6a, 0x52, 0x97, 0xff, 0x00, 0x92, 0x74, 0xc0, |
|
| 1026 |
- 0x4e, 0xe8, 0xcb, 0x25, 0x57, 0x7b, 0xd5, 0xd5, 0x4d, 0x53, 0xcd, 0xc6, 0x6e, 0xf6, 0x6d, 0x35, |
|
| 1027 |
- 0x13, 0x98, 0x3e, 0xda, 0x07, 0x6d, 0xc1, 0x30, 0xfd, 0x69, 0x2c, 0x15, 0x99, 0xa4, 0x2a, 0xf0, |
|
| 1028 |
- 0xfb, 0xa1, 0xec, 0x41, 0x19, 0x5f, 0x61, 0x4f, 0x78, 0xaa, 0x62, 0x45, 0x3d, 0x58, 0xdd, 0x34, |
|
| 1029 |
- 0x4b, 0x83, 0x2b, 0xec, 0x99, 0x7d, 0xbb, 0x24, 0x28, 0xd3, 0xef, 0xf9, 0xd7, 0xb7, 0x8d, 0xdc, |
|
| 1030 |
- 0x97, 0xdb, 0x46, 0xee, 0xc3, 0xaa, 0xa1, 0x5c, 0xaf, 0x1a, 0xca, 0xe7, 0x55, 0x43, 0xf9, 0xbe, |
|
| 1031 |
- 0x6a, 0x28, 0x6f, 0x9f, 0xff, 0xfe, 0xdf, 0xcb, 0x93, 0xec, 0xf7, 0x75, 0x6e, 0x52, 0x92, 0x7b, |
|
| 1032 |
- 0xff, 0xff, 0x47, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa3, 0x9a, 0x54, 0x17, 0xb5, 0x04, 0x00, 0x00, |
|
| 1033 |
-} |
| ... | ... |
@@ -1,8 +1,10 @@ |
| 1 | 1 |
package hcsshim |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "context" |
|
| 4 | 5 |
"fmt" |
| 5 | 6 |
"os" |
| 7 |
+ "sync" |
|
| 6 | 8 |
"time" |
| 7 | 9 |
|
| 8 | 10 |
"github.com/Microsoft/hcsshim/internal/hcs" |
| ... | ... |
@@ -52,7 +54,10 @@ const ( |
| 52 | 52 |
type ResourceModificationRequestResponse = schema1.ResourceModificationRequestResponse |
| 53 | 53 |
|
| 54 | 54 |
type container struct {
|
| 55 |
- system *hcs.System |
|
| 55 |
+ system *hcs.System |
|
| 56 |
+ waitOnce sync.Once |
|
| 57 |
+ waitErr error |
|
| 58 |
+ waitCh chan struct{}
|
|
| 56 | 59 |
} |
| 57 | 60 |
|
| 58 | 61 |
// createComputeSystemAdditionalJSON is read from the environment at initialisation |
| ... | ... |
@@ -71,61 +76,87 @@ func CreateContainer(id string, c *ContainerConfig) (Container, error) {
|
| 71 | 71 |
return nil, fmt.Errorf("failed to merge additional JSON '%s': %s", createContainerAdditionalJSON, err)
|
| 72 | 72 |
} |
| 73 | 73 |
|
| 74 |
- system, err := hcs.CreateComputeSystem(id, fullConfig) |
|
| 74 |
+ system, err := hcs.CreateComputeSystem(context.Background(), id, fullConfig) |
|
| 75 | 75 |
if err != nil {
|
| 76 | 76 |
return nil, err |
| 77 | 77 |
} |
| 78 |
- return &container{system}, err
|
|
| 78 |
+ return &container{system: system}, err
|
|
| 79 | 79 |
} |
| 80 | 80 |
|
| 81 | 81 |
// OpenContainer opens an existing container by ID. |
| 82 | 82 |
func OpenContainer(id string) (Container, error) {
|
| 83 |
- system, err := hcs.OpenComputeSystem(id) |
|
| 83 |
+ system, err := hcs.OpenComputeSystem(context.Background(), id) |
|
| 84 | 84 |
if err != nil {
|
| 85 | 85 |
return nil, err |
| 86 | 86 |
} |
| 87 |
- return &container{system}, err
|
|
| 87 |
+ return &container{system: system}, err
|
|
| 88 | 88 |
} |
| 89 | 89 |
|
| 90 | 90 |
// GetContainers gets a list of the containers on the system that match the query |
| 91 | 91 |
func GetContainers(q ComputeSystemQuery) ([]ContainerProperties, error) {
|
| 92 |
- return hcs.GetComputeSystems(q) |
|
| 92 |
+ return hcs.GetComputeSystems(context.Background(), q) |
|
| 93 | 93 |
} |
| 94 | 94 |
|
| 95 | 95 |
// Start synchronously starts the container. |
| 96 | 96 |
func (container *container) Start() error {
|
| 97 |
- return convertSystemError(container.system.Start(), container) |
|
| 97 |
+ return convertSystemError(container.system.Start(context.Background()), container) |
|
| 98 | 98 |
} |
| 99 | 99 |
|
| 100 | 100 |
// Shutdown requests a container shutdown, but it may not actually be shutdown until Wait() succeeds. |
| 101 | 101 |
func (container *container) Shutdown() error {
|
| 102 |
- return convertSystemError(container.system.Shutdown(), container) |
|
| 102 |
+ err := container.system.Shutdown(context.Background()) |
|
| 103 |
+ if err != nil {
|
|
| 104 |
+ return convertSystemError(err, container) |
|
| 105 |
+ } |
|
| 106 |
+ return &ContainerError{Container: container, Err: ErrVmcomputeOperationPending, Operation: "hcsshim::ComputeSystem::Shutdown"}
|
|
| 103 | 107 |
} |
| 104 | 108 |
|
| 105 | 109 |
// Terminate requests a container terminate, but it may not actually be terminated until Wait() succeeds. |
| 106 | 110 |
func (container *container) Terminate() error {
|
| 107 |
- return convertSystemError(container.system.Terminate(), container) |
|
| 111 |
+ err := container.system.Terminate(context.Background()) |
|
| 112 |
+ if err != nil {
|
|
| 113 |
+ return convertSystemError(err, container) |
|
| 114 |
+ } |
|
| 115 |
+ return &ContainerError{Container: container, Err: ErrVmcomputeOperationPending, Operation: "hcsshim::ComputeSystem::Terminate"}
|
|
| 108 | 116 |
} |
| 109 | 117 |
|
| 110 | 118 |
// Waits synchronously waits for the container to shutdown or terminate. |
| 111 | 119 |
func (container *container) Wait() error {
|
| 112 |
- return convertSystemError(container.system.Wait(), container) |
|
| 120 |
+ err := container.system.Wait() |
|
| 121 |
+ if err == nil {
|
|
| 122 |
+ err = container.system.ExitError() |
|
| 123 |
+ } |
|
| 124 |
+ return convertSystemError(err, container) |
|
| 113 | 125 |
} |
| 114 | 126 |
|
| 115 | 127 |
// WaitTimeout synchronously waits for the container to terminate or the duration to elapse. It |
| 116 | 128 |
// returns false if timeout occurs. |
| 117 |
-func (container *container) WaitTimeout(t time.Duration) error {
|
|
| 118 |
- return convertSystemError(container.system.WaitTimeout(t), container) |
|
| 129 |
+func (container *container) WaitTimeout(timeout time.Duration) error {
|
|
| 130 |
+ container.waitOnce.Do(func() {
|
|
| 131 |
+ container.waitCh = make(chan struct{})
|
|
| 132 |
+ go func() {
|
|
| 133 |
+ container.waitErr = container.Wait() |
|
| 134 |
+ close(container.waitCh) |
|
| 135 |
+ }() |
|
| 136 |
+ }) |
|
| 137 |
+ t := time.NewTimer(timeout) |
|
| 138 |
+ defer t.Stop() |
|
| 139 |
+ select {
|
|
| 140 |
+ case <-t.C: |
|
| 141 |
+ return &ContainerError{Container: container, Err: ErrTimeout, Operation: "hcsshim::ComputeSystem::Wait"}
|
|
| 142 |
+ case <-container.waitCh: |
|
| 143 |
+ return container.waitErr |
|
| 144 |
+ } |
|
| 119 | 145 |
} |
| 120 | 146 |
|
| 121 | 147 |
// Pause pauses the execution of a container. |
| 122 | 148 |
func (container *container) Pause() error {
|
| 123 |
- return convertSystemError(container.system.Pause(), container) |
|
| 149 |
+ return convertSystemError(container.system.Pause(context.Background()), container) |
|
| 124 | 150 |
} |
| 125 | 151 |
|
| 126 | 152 |
// Resume resumes the execution of a container. |
| 127 | 153 |
func (container *container) Resume() error {
|
| 128 |
- return convertSystemError(container.system.Resume(), container) |
|
| 154 |
+ return convertSystemError(container.system.Resume(context.Background()), container) |
|
| 129 | 155 |
} |
| 130 | 156 |
|
| 131 | 157 |
// HasPendingUpdates returns true if the container has updates pending to install |
| ... | ... |
@@ -135,7 +166,7 @@ func (container *container) HasPendingUpdates() (bool, error) {
|
| 135 | 135 |
|
| 136 | 136 |
// Statistics returns statistics for the container. This is a legacy v1 call |
| 137 | 137 |
func (container *container) Statistics() (Statistics, error) {
|
| 138 |
- properties, err := container.system.Properties(schema1.PropertyTypeStatistics) |
|
| 138 |
+ properties, err := container.system.Properties(context.Background(), schema1.PropertyTypeStatistics) |
|
| 139 | 139 |
if err != nil {
|
| 140 | 140 |
return Statistics{}, convertSystemError(err, container)
|
| 141 | 141 |
} |
| ... | ... |
@@ -145,7 +176,7 @@ func (container *container) Statistics() (Statistics, error) {
|
| 145 | 145 |
|
| 146 | 146 |
// ProcessList returns an array of ProcessListItems for the container. This is a legacy v1 call |
| 147 | 147 |
func (container *container) ProcessList() ([]ProcessListItem, error) {
|
| 148 |
- properties, err := container.system.Properties(schema1.PropertyTypeProcessList) |
|
| 148 |
+ properties, err := container.system.Properties(context.Background(), schema1.PropertyTypeProcessList) |
|
| 149 | 149 |
if err != nil {
|
| 150 | 150 |
return nil, convertSystemError(err, container) |
| 151 | 151 |
} |
| ... | ... |
@@ -155,7 +186,7 @@ func (container *container) ProcessList() ([]ProcessListItem, error) {
|
| 155 | 155 |
|
| 156 | 156 |
// This is a legacy v1 call |
| 157 | 157 |
func (container *container) MappedVirtualDisks() (map[int]MappedVirtualDiskController, error) {
|
| 158 |
- properties, err := container.system.Properties(schema1.PropertyTypeMappedVirtualDisk) |
|
| 158 |
+ properties, err := container.system.Properties(context.Background(), schema1.PropertyTypeMappedVirtualDisk) |
|
| 159 | 159 |
if err != nil {
|
| 160 | 160 |
return nil, convertSystemError(err, container) |
| 161 | 161 |
} |
| ... | ... |
@@ -165,20 +196,20 @@ func (container *container) MappedVirtualDisks() (map[int]MappedVirtualDiskContr |
| 165 | 165 |
|
| 166 | 166 |
// CreateProcess launches a new process within the container. |
| 167 | 167 |
func (container *container) CreateProcess(c *ProcessConfig) (Process, error) {
|
| 168 |
- p, err := container.system.CreateProcess(c) |
|
| 168 |
+ p, err := container.system.CreateProcess(context.Background(), c) |
|
| 169 | 169 |
if err != nil {
|
| 170 | 170 |
return nil, convertSystemError(err, container) |
| 171 | 171 |
} |
| 172 |
- return &process{p}, nil
|
|
| 172 |
+ return &process{p: p.(*hcs.Process)}, nil
|
|
| 173 | 173 |
} |
| 174 | 174 |
|
| 175 | 175 |
// OpenProcess gets an interface to an existing process within the container. |
| 176 | 176 |
func (container *container) OpenProcess(pid int) (Process, error) {
|
| 177 |
- p, err := container.system.OpenProcess(pid) |
|
| 177 |
+ p, err := container.system.OpenProcess(context.Background(), pid) |
|
| 178 | 178 |
if err != nil {
|
| 179 | 179 |
return nil, convertSystemError(err, container) |
| 180 | 180 |
} |
| 181 |
- return &process{p}, nil
|
|
| 181 |
+ return &process{p: p}, nil
|
|
| 182 | 182 |
} |
| 183 | 183 |
|
| 184 | 184 |
// Close cleans up any state associated with the container but does not terminate or wait for it. |
| ... | ... |
@@ -188,5 +219,5 @@ func (container *container) Close() error {
|
| 188 | 188 |
|
| 189 | 189 |
// Modify the System |
| 190 | 190 |
func (container *container) Modify(config *ResourceModificationRequestResponse) error {
|
| 191 |
- return convertSystemError(container.system.Modify(config), container) |
|
| 191 |
+ return convertSystemError(container.system.Modify(context.Background(), config), container) |
|
| 192 | 192 |
} |
| 193 | 193 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,37 @@ |
| 0 |
+module github.com/Microsoft/hcsshim |
|
| 1 |
+ |
|
| 2 |
+go 1.13 |
|
| 3 |
+ |
|
| 4 |
+require ( |
|
| 5 |
+ github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5 |
|
| 6 |
+ github.com/blang/semver v3.1.0+incompatible // indirect |
|
| 7 |
+ github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f |
|
| 8 |
+ github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1 |
|
| 9 |
+ github.com/containerd/containerd v1.3.0-beta.2.0.20190828155532-0293cbd26c69 |
|
| 10 |
+ github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc // indirect |
|
| 11 |
+ github.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448 // indirect |
|
| 12 |
+ github.com/containerd/go-runc v0.0.0-20180907222934-5a6d9f37cfa3 |
|
| 13 |
+ github.com/containerd/ttrpc v0.0.0-20190828154514-0e0f228740de |
|
| 14 |
+ github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd |
|
| 15 |
+ github.com/gogo/protobuf v1.2.1 |
|
| 16 |
+ github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce // indirect |
|
| 17 |
+ github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874 // indirect |
|
| 18 |
+ github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2 // indirect |
|
| 19 |
+ github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f // indirect |
|
| 20 |
+ github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700 |
|
| 21 |
+ github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39 |
|
| 22 |
+ github.com/pkg/errors v0.8.1 |
|
| 23 |
+ github.com/prometheus/procfs v0.0.5 // indirect |
|
| 24 |
+ github.com/sirupsen/logrus v1.4.1 |
|
| 25 |
+ github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8 // indirect |
|
| 26 |
+ github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5 |
|
| 27 |
+ github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect |
|
| 28 |
+ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect |
|
| 29 |
+ github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f // indirect |
|
| 30 |
+ go.opencensus.io v0.22.0 |
|
| 31 |
+ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6 |
|
| 32 |
+ golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3 |
|
| 33 |
+ google.golang.org/grpc v1.20.1 |
|
| 34 |
+ gotest.tools v2.2.0+incompatible // indirect |
|
| 35 |
+ k8s.io/kubernetes v1.13.0 |
|
| 36 |
+) |
| ... | ... |
@@ -39,11 +39,21 @@ func HNSListEndpointRequest() ([]HNSEndpoint, error) {
|
| 39 | 39 |
|
| 40 | 40 |
// HotAttachEndpoint makes a HCS Call to attach the endpoint to the container |
| 41 | 41 |
func HotAttachEndpoint(containerID string, endpointID string) error {
|
| 42 |
+ endpoint, err := GetHNSEndpointByID(endpointID) |
|
| 43 |
+ isAttached, err := endpoint.IsAttached(containerID) |
|
| 44 |
+ if isAttached {
|
|
| 45 |
+ return err |
|
| 46 |
+ } |
|
| 42 | 47 |
return modifyNetworkEndpoint(containerID, endpointID, Add) |
| 43 | 48 |
} |
| 44 | 49 |
|
| 45 | 50 |
// HotDetachEndpoint makes a HCS Call to detach the endpoint from the container |
| 46 | 51 |
func HotDetachEndpoint(containerID string, endpointID string) error {
|
| 52 |
+ endpoint, err := GetHNSEndpointByID(endpointID) |
|
| 53 |
+ isAttached, err := endpoint.IsAttached(containerID) |
|
| 54 |
+ if !isAttached {
|
|
| 55 |
+ return err |
|
| 56 |
+ } |
|
| 47 | 57 |
return modifyNetworkEndpoint(containerID, endpointID, Remove) |
| 48 | 58 |
} |
| 49 | 59 |
|
| 50 | 60 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,83 @@ |
| 0 |
+package cow |
|
| 1 |
+ |
|
| 2 |
+import ( |
|
| 3 |
+ "context" |
|
| 4 |
+ "io" |
|
| 5 |
+ |
|
| 6 |
+ "github.com/Microsoft/hcsshim/internal/schema1" |
|
| 7 |
+ hcsschema "github.com/Microsoft/hcsshim/internal/schema2" |
|
| 8 |
+) |
|
| 9 |
+ |
|
| 10 |
+// Process is the interface for an OS process running in a container or utility VM. |
|
| 11 |
+type Process interface {
|
|
| 12 |
+ // Close releases resources associated with the process and closes the |
|
| 13 |
+ // writer and readers returned by Stdio. Depending on the implementation, |
|
| 14 |
+ // this may also terminate the process. |
|
| 15 |
+ Close() error |
|
| 16 |
+ // CloseStdin causes the process's stdin handle to receive EOF/EPIPE/whatever |
|
| 17 |
+ // is appropriate to indicate that no more data is available. |
|
| 18 |
+ CloseStdin(ctx context.Context) error |
|
| 19 |
+ // Pid returns the process ID. |
|
| 20 |
+ Pid() int |
|
| 21 |
+ // Stdio returns the stdio streams for a process. These may be nil if a stream |
|
| 22 |
+ // was not requested during CreateProcess. |
|
| 23 |
+ Stdio() (_ io.Writer, _ io.Reader, _ io.Reader) |
|
| 24 |
+ // ResizeConsole resizes the virtual terminal associated with the process. |
|
| 25 |
+ ResizeConsole(ctx context.Context, width, height uint16) error |
|
| 26 |
+ // Kill sends a SIGKILL or equivalent signal to the process and returns whether |
|
| 27 |
+ // the signal was delivered. It does not wait for the process to terminate. |
|
| 28 |
+ Kill(ctx context.Context) (bool, error) |
|
| 29 |
+ // Signal sends a signal to the process and returns whether the signal was |
|
| 30 |
+ // delivered. The input is OS specific (either |
|
| 31 |
+ // guestrequest.SignalProcessOptionsWCOW or |
|
| 32 |
+ // guestrequest.SignalProcessOptionsLCOW). It does not wait for the process |
|
| 33 |
+ // to terminate. |
|
| 34 |
+ Signal(ctx context.Context, options interface{}) (bool, error)
|
|
| 35 |
+ // Wait waits for the process to complete, or for a connection to the process to be |
|
| 36 |
+ // terminated by some error condition (including calling Close). |
|
| 37 |
+ Wait() error |
|
| 38 |
+ // ExitCode returns the exit code of the process. Returns an error if the process is |
|
| 39 |
+ // not running. |
|
| 40 |
+ ExitCode() (int, error) |
|
| 41 |
+} |
|
| 42 |
+ |
|
| 43 |
+// ProcessHost is the interface for creating processes. |
|
| 44 |
+type ProcessHost interface {
|
|
| 45 |
+ // CreateProcess creates a process. The configuration is host specific |
|
| 46 |
+ // (either hcsschema.ProcessParameters or lcow.ProcessParameters). |
|
| 47 |
+ CreateProcess(ctx context.Context, config interface{}) (Process, error)
|
|
| 48 |
+ // OS returns the host's operating system, "linux" or "windows". |
|
| 49 |
+ OS() string |
|
| 50 |
+ // IsOCI specifies whether this is an OCI-compliant process host. If true, |
|
| 51 |
+ // then the configuration passed to CreateProcess should have an OCI process |
|
| 52 |
+ // spec (or nil if this is the initial process in an OCI container). |
|
| 53 |
+ // Otherwise, it should have the HCS-specific process parameters. |
|
| 54 |
+ IsOCI() bool |
|
| 55 |
+} |
|
| 56 |
+ |
|
| 57 |
+// Container is the interface for container objects, either running on the host or |
|
| 58 |
+// in a utility VM. |
|
| 59 |
+type Container interface {
|
|
| 60 |
+ ProcessHost |
|
| 61 |
+ // Close releases the resources associated with the container. Depending on |
|
| 62 |
+ // the implementation, this may also terminate the container. |
|
| 63 |
+ Close() error |
|
| 64 |
+ // ID returns the container ID. |
|
| 65 |
+ ID() string |
|
| 66 |
+ // Properties returns the requested container properties targeting a V1 schema container. |
|
| 67 |
+ Properties(ctx context.Context, types ...schema1.PropertyType) (*schema1.ContainerProperties, error) |
|
| 68 |
+ // PropertiesV2 returns the requested container properties targeting a V2 schema container. |
|
| 69 |
+ PropertiesV2(ctx context.Context, types ...hcsschema.PropertyType) (*hcsschema.Properties, error) |
|
| 70 |
+ // Start starts a container. |
|
| 71 |
+ Start(ctx context.Context) error |
|
| 72 |
+ // Shutdown sends a shutdown request to the container (but does not wait for |
|
| 73 |
+ // the shutdown to complete). |
|
| 74 |
+ Shutdown(ctx context.Context) error |
|
| 75 |
+ // Terminate sends a terminate request to the container (but does not wait |
|
| 76 |
+ // for the terminate to complete). |
|
| 77 |
+ Terminate(ctx context.Context) error |
|
| 78 |
+ // Wait waits for the container to terminate, or for the connection to the |
|
| 79 |
+ // container to be terminated by some error condition (including calling |
|
| 80 |
+ // Close). |
|
| 81 |
+ Wait() error |
|
| 82 |
+} |
| 0 | 83 |
deleted file mode 100644 |
| ... | ... |
@@ -1,69 +0,0 @@ |
| 1 |
-package guid |
|
| 2 |
- |
|
| 3 |
-import ( |
|
| 4 |
- "crypto/rand" |
|
| 5 |
- "encoding/json" |
|
| 6 |
- "fmt" |
|
| 7 |
- "io" |
|
| 8 |
- "strconv" |
|
| 9 |
- "strings" |
|
| 10 |
-) |
|
| 11 |
- |
|
| 12 |
-var _ = (json.Marshaler)(&GUID{})
|
|
| 13 |
-var _ = (json.Unmarshaler)(&GUID{})
|
|
| 14 |
- |
|
| 15 |
-type GUID [16]byte |
|
| 16 |
- |
|
| 17 |
-func New() GUID {
|
|
| 18 |
- g := GUID{}
|
|
| 19 |
- _, err := io.ReadFull(rand.Reader, g[:]) |
|
| 20 |
- if err != nil {
|
|
| 21 |
- panic(err) |
|
| 22 |
- } |
|
| 23 |
- return g |
|
| 24 |
-} |
|
| 25 |
- |
|
| 26 |
-func (g GUID) String() string {
|
|
| 27 |
- return fmt.Sprintf("%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x-%02x", g[3], g[2], g[1], g[0], g[5], g[4], g[7], g[6], g[8:10], g[10:])
|
|
| 28 |
-} |
|
| 29 |
- |
|
| 30 |
-func FromString(s string) GUID {
|
|
| 31 |
- if len(s) != 36 {
|
|
| 32 |
- panic(fmt.Sprintf("invalid GUID length: %d", len(s)))
|
|
| 33 |
- } |
|
| 34 |
- if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' {
|
|
| 35 |
- panic("invalid GUID format")
|
|
| 36 |
- } |
|
| 37 |
- indexOrder := [16]int{
|
|
| 38 |
- 0, 2, 4, 6, |
|
| 39 |
- 9, 11, |
|
| 40 |
- 14, 16, |
|
| 41 |
- 19, 21, |
|
| 42 |
- 24, 26, 28, 30, 32, 34, |
|
| 43 |
- } |
|
| 44 |
- byteOrder := [16]int{
|
|
| 45 |
- 3, 2, 1, 0, |
|
| 46 |
- 5, 4, |
|
| 47 |
- 7, 6, |
|
| 48 |
- 8, 9, |
|
| 49 |
- 10, 11, 12, 13, 14, 15, |
|
| 50 |
- } |
|
| 51 |
- var g GUID |
|
| 52 |
- for i, x := range indexOrder {
|
|
| 53 |
- b, err := strconv.ParseInt(s[x:x+2], 16, 16) |
|
| 54 |
- if err != nil {
|
|
| 55 |
- panic(err) |
|
| 56 |
- } |
|
| 57 |
- g[byteOrder[i]] = byte(b) |
|
| 58 |
- } |
|
| 59 |
- return g |
|
| 60 |
-} |
|
| 61 |
- |
|
| 62 |
-func (g GUID) MarshalJSON() ([]byte, error) {
|
|
| 63 |
- return json.Marshal(g.String()) |
|
| 64 |
-} |
|
| 65 |
- |
|
| 66 |
-func (g *GUID) UnmarshalJSON(data []byte) error {
|
|
| 67 |
- *g = FromString(strings.Trim(string(data), "\"")) |
|
| 68 |
- return nil |
|
| 69 |
-} |
| ... | ... |
@@ -7,6 +7,7 @@ import ( |
| 7 | 7 |
|
| 8 | 8 |
"github.com/Microsoft/hcsshim/internal/interop" |
| 9 | 9 |
"github.com/Microsoft/hcsshim/internal/logfields" |
| 10 |
+ "github.com/Microsoft/hcsshim/internal/vmcompute" |
|
| 10 | 11 |
"github.com/sirupsen/logrus" |
| 11 | 12 |
) |
| 12 | 13 |
|
| ... | ... |
@@ -88,7 +89,7 @@ type notificationChannel chan error |
| 88 | 88 |
|
| 89 | 89 |
type notifcationWatcherContext struct {
|
| 90 | 90 |
channels notificationChannels |
| 91 |
- handle hcsCallback |
|
| 91 |
+ handle vmcompute.HcsCallback |
|
| 92 | 92 |
|
| 93 | 93 |
systemID string |
| 94 | 94 |
processID int |
| ... | ... |
@@ -98,21 +99,27 @@ type notificationChannels map[hcsNotification]notificationChannel |
| 98 | 98 |
|
| 99 | 99 |
func newSystemChannels() notificationChannels {
|
| 100 | 100 |
channels := make(notificationChannels) |
| 101 |
- |
|
| 102 |
- channels[hcsNotificationSystemExited] = make(notificationChannel, 1) |
|
| 103 |
- channels[hcsNotificationSystemCreateCompleted] = make(notificationChannel, 1) |
|
| 104 |
- channels[hcsNotificationSystemStartCompleted] = make(notificationChannel, 1) |
|
| 105 |
- channels[hcsNotificationSystemPauseCompleted] = make(notificationChannel, 1) |
|
| 106 |
- channels[hcsNotificationSystemResumeCompleted] = make(notificationChannel, 1) |
|
| 107 |
- |
|
| 101 |
+ for _, notif := range []hcsNotification{
|
|
| 102 |
+ hcsNotificationServiceDisconnect, |
|
| 103 |
+ hcsNotificationSystemExited, |
|
| 104 |
+ hcsNotificationSystemCreateCompleted, |
|
| 105 |
+ hcsNotificationSystemStartCompleted, |
|
| 106 |
+ hcsNotificationSystemPauseCompleted, |
|
| 107 |
+ hcsNotificationSystemResumeCompleted, |
|
| 108 |
+ } {
|
|
| 109 |
+ channels[notif] = make(notificationChannel, 1) |
|
| 110 |
+ } |
|
| 108 | 111 |
return channels |
| 109 | 112 |
} |
| 110 | 113 |
|
| 111 | 114 |
func newProcessChannels() notificationChannels {
|
| 112 | 115 |
channels := make(notificationChannels) |
| 113 |
- |
|
| 114 |
- channels[hcsNotificationProcessExited] = make(notificationChannel, 1) |
|
| 115 |
- |
|
| 116 |
+ for _, notif := range []hcsNotification{
|
|
| 117 |
+ hcsNotificationServiceDisconnect, |
|
| 118 |
+ hcsNotificationProcessExited, |
|
| 119 |
+ } {
|
|
| 120 |
+ channels[notif] = make(notificationChannel, 1) |
|
| 121 |
+ } |
|
| 116 | 122 |
return channels |
| 117 | 123 |
} |
| 118 | 124 |
|
| ... | ... |
@@ -143,18 +150,7 @@ func notificationWatcher(notificationType hcsNotification, callbackNumber uintpt |
| 143 | 143 |
if context.processID != 0 {
|
| 144 | 144 |
log.Data[logfields.ProcessID] = context.processID |
| 145 | 145 |
} |
| 146 |
- log.Debug("")
|
|
| 147 |
- |
|
| 148 |
- // The HCS notification system can grow overtime. We explicitly opt-in to |
|
| 149 |
- // the notifications we would like to handle, all others we simply return. |
|
| 150 |
- // This means that as it grows we don't have issues associated with new |
|
| 151 |
- // notification types the code didn't know about. |
|
| 152 |
- switch notificationType {
|
|
| 153 |
- case hcsNotificationSystemExited, hcsNotificationSystemCreateCompleted, hcsNotificationSystemStartCompleted, hcsNotificationSystemPauseCompleted, hcsNotificationSystemResumeCompleted: |
|
| 154 |
- case hcsNotificationProcessExited: |
|
| 155 |
- default: |
|
| 156 |
- return 0 |
|
| 157 |
- } |
|
| 146 |
+ log.Debug("HCS notification")
|
|
| 158 | 147 |
|
| 159 | 148 |
if channel, ok := context.channels[notificationType]; ok {
|
| 160 | 149 |
channel <- result |
| ... | ... |
@@ -1,14 +1,14 @@ |
| 1 | 1 |
package hcs |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "context" |
|
| 4 | 5 |
"encoding/json" |
| 5 | 6 |
"errors" |
| 6 | 7 |
"fmt" |
| 8 |
+ "net" |
|
| 7 | 9 |
"syscall" |
| 8 | 10 |
|
| 9 |
- "github.com/Microsoft/hcsshim/internal/interop" |
|
| 10 |
- "github.com/Microsoft/hcsshim/internal/logfields" |
|
| 11 |
- "github.com/sirupsen/logrus" |
|
| 11 |
+ "github.com/Microsoft/hcsshim/internal/log" |
|
| 12 | 12 |
) |
| 13 | 13 |
|
| 14 | 14 |
var ( |
| ... | ... |
@@ -117,17 +117,11 @@ func (ev *ErrorEvent) String() string {
|
| 117 | 117 |
return evs |
| 118 | 118 |
} |
| 119 | 119 |
|
| 120 |
-func processHcsResult(resultp *uint16) []ErrorEvent {
|
|
| 121 |
- if resultp != nil {
|
|
| 122 |
- resultj := interop.ConvertAndFreeCoTaskMemString(resultp) |
|
| 123 |
- logrus.WithField(logfields.JSON, resultj). |
|
| 124 |
- Debug("HCS Result")
|
|
| 120 |
+func processHcsResult(ctx context.Context, resultJSON string) []ErrorEvent {
|
|
| 121 |
+ if resultJSON != "" {
|
|
| 125 | 122 |
result := &hcsResult{}
|
| 126 |
- if err := json.Unmarshal([]byte(resultj), result); err != nil {
|
|
| 127 |
- logrus.WithFields(logrus.Fields{
|
|
| 128 |
- logfields.JSON: resultj, |
|
| 129 |
- logrus.ErrorKey: err, |
|
| 130 |
- }).Warning("Could not unmarshal HCS result")
|
|
| 123 |
+ if err := json.Unmarshal([]byte(resultJSON), result); err != nil {
|
|
| 124 |
+ log.G(ctx).WithError(err).Warning("Could not unmarshal HCS result")
|
|
| 131 | 125 |
return nil |
| 132 | 126 |
} |
| 133 | 127 |
return result.ErrorEvents |
| ... | ... |
@@ -141,6 +135,8 @@ type HcsError struct {
|
| 141 | 141 |
Events []ErrorEvent |
| 142 | 142 |
} |
| 143 | 143 |
|
| 144 |
+var _ net.Error = &HcsError{}
|
|
| 145 |
+ |
|
| 144 | 146 |
func (e *HcsError) Error() string {
|
| 145 | 147 |
s := e.Op + ": " + e.Err.Error() |
| 146 | 148 |
for _, ev := range e.Events {
|
| ... | ... |
@@ -149,6 +145,16 @@ func (e *HcsError) Error() string {
|
| 149 | 149 |
return s |
| 150 | 150 |
} |
| 151 | 151 |
|
| 152 |
+func (e *HcsError) Temporary() bool {
|
|
| 153 |
+ err, ok := e.Err.(net.Error) |
|
| 154 |
+ return ok && err.Temporary() |
|
| 155 |
+} |
|
| 156 |
+ |
|
| 157 |
+func (e *HcsError) Timeout() bool {
|
|
| 158 |
+ err, ok := e.Err.(net.Error) |
|
| 159 |
+ return ok && err.Timeout() |
|
| 160 |
+} |
|
| 161 |
+ |
|
| 152 | 162 |
// ProcessError is an error encountered in HCS during an operation on a Process object |
| 153 | 163 |
type ProcessError struct {
|
| 154 | 164 |
SystemID string |
| ... | ... |
@@ -158,6 +164,8 @@ type ProcessError struct {
|
| 158 | 158 |
Events []ErrorEvent |
| 159 | 159 |
} |
| 160 | 160 |
|
| 161 |
+var _ net.Error = &ProcessError{}
|
|
| 162 |
+ |
|
| 161 | 163 |
// SystemError is an error encountered in HCS during an operation on a Container object |
| 162 | 164 |
type SystemError struct {
|
| 163 | 165 |
ID string |
| ... | ... |
@@ -167,6 +175,8 @@ type SystemError struct {
|
| 167 | 167 |
Events []ErrorEvent |
| 168 | 168 |
} |
| 169 | 169 |
|
| 170 |
+var _ net.Error = &SystemError{}
|
|
| 171 |
+ |
|
| 170 | 172 |
func (e *SystemError) Error() string {
|
| 171 | 173 |
s := e.Op + " " + e.ID + ": " + e.Err.Error() |
| 172 | 174 |
for _, ev := range e.Events {
|
| ... | ... |
@@ -178,6 +188,16 @@ func (e *SystemError) Error() string {
|
| 178 | 178 |
return s |
| 179 | 179 |
} |
| 180 | 180 |
|
| 181 |
+func (e *SystemError) Temporary() bool {
|
|
| 182 |
+ err, ok := e.Err.(net.Error) |
|
| 183 |
+ return ok && err.Temporary() |
|
| 184 |
+} |
|
| 185 |
+ |
|
| 186 |
+func (e *SystemError) Timeout() bool {
|
|
| 187 |
+ err, ok := e.Err.(net.Error) |
|
| 188 |
+ return ok && err.Timeout() |
|
| 189 |
+} |
|
| 190 |
+ |
|
| 181 | 191 |
func makeSystemError(system *System, op string, extra string, err error, events []ErrorEvent) error {
|
| 182 | 192 |
// Don't double wrap errors |
| 183 | 193 |
if _, ok := err.(*SystemError); ok {
|
| ... | ... |
@@ -200,6 +220,16 @@ func (e *ProcessError) Error() string {
|
| 200 | 200 |
return s |
| 201 | 201 |
} |
| 202 | 202 |
|
| 203 |
+func (e *ProcessError) Temporary() bool {
|
|
| 204 |
+ err, ok := e.Err.(net.Error) |
|
| 205 |
+ return ok && err.Temporary() |
|
| 206 |
+} |
|
| 207 |
+ |
|
| 208 |
+func (e *ProcessError) Timeout() bool {
|
|
| 209 |
+ err, ok := e.Err.(net.Error) |
|
| 210 |
+ return ok && err.Timeout() |
|
| 211 |
+} |
|
| 212 |
+ |
|
| 203 | 213 |
func makeProcessError(process *Process, op string, err error, events []ErrorEvent) error {
|
| 204 | 214 |
// Don't double wrap errors |
| 205 | 215 |
if _, ok := err.(*ProcessError); ok {
|
| ... | ... |
@@ -242,6 +272,9 @@ func IsPending(err error) bool {
|
| 242 | 242 |
// IsTimeout returns a boolean indicating whether the error is caused by |
| 243 | 243 |
// a timeout waiting for the operation to complete. |
| 244 | 244 |
func IsTimeout(err error) bool {
|
| 245 |
+ if err, ok := err.(net.Error); ok && err.Timeout() {
|
|
| 246 |
+ return true |
|
| 247 |
+ } |
|
| 245 | 248 |
err = getInnerError(err) |
| 246 | 249 |
return err == ErrTimeout |
| 247 | 250 |
} |
| ... | ... |
@@ -292,3 +325,12 @@ func getInnerError(err error) error {
|
| 292 | 292 |
} |
| 293 | 293 |
return err |
| 294 | 294 |
} |
| 295 |
+ |
|
| 296 |
+func getOperationLogResult(err error) (string, error) {
|
|
| 297 |
+ switch err {
|
|
| 298 |
+ case nil: |
|
| 299 |
+ return "Success", nil |
|
| 300 |
+ default: |
|
| 301 |
+ return "Error", err |
|
| 302 |
+ } |
|
| 303 |
+} |
| 295 | 304 |
deleted file mode 100644 |
| ... | ... |
@@ -1,48 +0,0 @@ |
| 1 |
-// Shim for the Host Compute Service (HCS) to manage Windows Server |
|
| 2 |
-// containers and Hyper-V containers. |
|
| 3 |
- |
|
| 4 |
-package hcs |
|
| 5 |
- |
|
| 6 |
-import ( |
|
| 7 |
- "syscall" |
|
| 8 |
-) |
|
| 9 |
- |
|
| 10 |
-//go:generate go run ../../mksyscall_windows.go -output zsyscall_windows.go hcs.go |
|
| 11 |
- |
|
| 12 |
-//sys hcsEnumerateComputeSystems(query string, computeSystems **uint16, result **uint16) (hr error) = vmcompute.HcsEnumerateComputeSystems? |
|
| 13 |
-//sys hcsCreateComputeSystem(id string, configuration string, identity syscall.Handle, computeSystem *hcsSystem, result **uint16) (hr error) = vmcompute.HcsCreateComputeSystem? |
|
| 14 |
-//sys hcsOpenComputeSystem(id string, computeSystem *hcsSystem, result **uint16) (hr error) = vmcompute.HcsOpenComputeSystem? |
|
| 15 |
-//sys hcsCloseComputeSystem(computeSystem hcsSystem) (hr error) = vmcompute.HcsCloseComputeSystem? |
|
| 16 |
-//sys hcsStartComputeSystem(computeSystem hcsSystem, options string, result **uint16) (hr error) = vmcompute.HcsStartComputeSystem? |
|
| 17 |
-//sys hcsShutdownComputeSystem(computeSystem hcsSystem, options string, result **uint16) (hr error) = vmcompute.HcsShutdownComputeSystem? |
|
| 18 |
-//sys hcsTerminateComputeSystem(computeSystem hcsSystem, options string, result **uint16) (hr error) = vmcompute.HcsTerminateComputeSystem? |
|
| 19 |
-//sys hcsPauseComputeSystem(computeSystem hcsSystem, options string, result **uint16) (hr error) = vmcompute.HcsPauseComputeSystem? |
|
| 20 |
-//sys hcsResumeComputeSystem(computeSystem hcsSystem, options string, result **uint16) (hr error) = vmcompute.HcsResumeComputeSystem? |
|
| 21 |
-//sys hcsGetComputeSystemProperties(computeSystem hcsSystem, propertyQuery string, properties **uint16, result **uint16) (hr error) = vmcompute.HcsGetComputeSystemProperties? |
|
| 22 |
-//sys hcsModifyComputeSystem(computeSystem hcsSystem, configuration string, result **uint16) (hr error) = vmcompute.HcsModifyComputeSystem? |
|
| 23 |
-//sys hcsRegisterComputeSystemCallback(computeSystem hcsSystem, callback uintptr, context uintptr, callbackHandle *hcsCallback) (hr error) = vmcompute.HcsRegisterComputeSystemCallback? |
|
| 24 |
-//sys hcsUnregisterComputeSystemCallback(callbackHandle hcsCallback) (hr error) = vmcompute.HcsUnregisterComputeSystemCallback? |
|
| 25 |
- |
|
| 26 |
-//sys hcsCreateProcess(computeSystem hcsSystem, processParameters string, processInformation *hcsProcessInformation, process *hcsProcess, result **uint16) (hr error) = vmcompute.HcsCreateProcess? |
|
| 27 |
-//sys hcsOpenProcess(computeSystem hcsSystem, pid uint32, process *hcsProcess, result **uint16) (hr error) = vmcompute.HcsOpenProcess? |
|
| 28 |
-//sys hcsCloseProcess(process hcsProcess) (hr error) = vmcompute.HcsCloseProcess? |
|
| 29 |
-//sys hcsTerminateProcess(process hcsProcess, result **uint16) (hr error) = vmcompute.HcsTerminateProcess? |
|
| 30 |
-//sys hcsSignalProcess(process hcsProcess, options string, result **uint16) (hr error) = vmcompute.HcsSignalProcess? |
|
| 31 |
-//sys hcsGetProcessInfo(process hcsProcess, processInformation *hcsProcessInformation, result **uint16) (hr error) = vmcompute.HcsGetProcessInfo? |
|
| 32 |
-//sys hcsGetProcessProperties(process hcsProcess, processProperties **uint16, result **uint16) (hr error) = vmcompute.HcsGetProcessProperties? |
|
| 33 |
-//sys hcsModifyProcess(process hcsProcess, settings string, result **uint16) (hr error) = vmcompute.HcsModifyProcess? |
|
| 34 |
-//sys hcsGetServiceProperties(propertyQuery string, properties **uint16, result **uint16) (hr error) = vmcompute.HcsGetServiceProperties? |
|
| 35 |
-//sys hcsRegisterProcessCallback(process hcsProcess, callback uintptr, context uintptr, callbackHandle *hcsCallback) (hr error) = vmcompute.HcsRegisterProcessCallback? |
|
| 36 |
-//sys hcsUnregisterProcessCallback(callbackHandle hcsCallback) (hr error) = vmcompute.HcsUnregisterProcessCallback? |
|
| 37 |
- |
|
| 38 |
-type hcsSystem syscall.Handle |
|
| 39 |
-type hcsProcess syscall.Handle |
|
| 40 |
-type hcsCallback syscall.Handle |
|
| 41 |
- |
|
| 42 |
-type hcsProcessInformation struct {
|
|
| 43 |
- ProcessId uint32 |
|
| 44 |
- Reserved uint32 |
|
| 45 |
- StdInput syscall.Handle |
|
| 46 |
- StdOutput syscall.Handle |
|
| 47 |
- StdError syscall.Handle |
|
| 48 |
-} |
| 49 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,20 +0,0 @@ |
| 1 |
-package hcs |
|
| 2 |
- |
|
| 3 |
-import "github.com/sirupsen/logrus" |
|
| 4 |
- |
|
| 5 |
-func logOperationBegin(ctx logrus.Fields, msg string) {
|
|
| 6 |
- logrus.WithFields(ctx).Debug(msg) |
|
| 7 |
-} |
|
| 8 |
- |
|
| 9 |
-func logOperationEnd(ctx logrus.Fields, msg string, err error) {
|
|
| 10 |
- // Copy the log and fields first. |
|
| 11 |
- log := logrus.WithFields(ctx) |
|
| 12 |
- if err == nil {
|
|
| 13 |
- log.Debug(msg) |
|
| 14 |
- } else {
|
|
| 15 |
- // Edit only the copied field data to avoid race conditions on the |
|
| 16 |
- // write. |
|
| 17 |
- log.Data[logrus.ErrorKey] = err |
|
| 18 |
- log.Error(msg) |
|
| 19 |
- } |
|
| 20 |
-} |
| ... | ... |
@@ -1,52 +1,47 @@ |
| 1 | 1 |
package hcs |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "context" |
|
| 4 | 5 |
"encoding/json" |
| 5 | 6 |
"io" |
| 6 | 7 |
"sync" |
| 7 | 8 |
"syscall" |
| 8 | 9 |
"time" |
| 9 | 10 |
|
| 10 |
- "github.com/Microsoft/hcsshim/internal/interop" |
|
| 11 |
- "github.com/Microsoft/hcsshim/internal/logfields" |
|
| 12 |
- "github.com/sirupsen/logrus" |
|
| 11 |
+ "github.com/Microsoft/hcsshim/internal/log" |
|
| 12 |
+ "github.com/Microsoft/hcsshim/internal/oc" |
|
| 13 |
+ "github.com/Microsoft/hcsshim/internal/vmcompute" |
|
| 14 |
+ "go.opencensus.io/trace" |
|
| 13 | 15 |
) |
| 14 | 16 |
|
| 15 | 17 |
// ContainerError is an error encountered in HCS |
| 16 | 18 |
type Process struct {
|
| 17 | 19 |
handleLock sync.RWMutex |
| 18 |
- handle hcsProcess |
|
| 20 |
+ handle vmcompute.HcsProcess |
|
| 19 | 21 |
processID int |
| 20 | 22 |
system *System |
| 21 |
- cachedPipes *cachedPipes |
|
| 23 |
+ hasCachedStdio bool |
|
| 24 |
+ stdioLock sync.Mutex |
|
| 25 |
+ stdin io.WriteCloser |
|
| 26 |
+ stdout io.ReadCloser |
|
| 27 |
+ stderr io.ReadCloser |
|
| 22 | 28 |
callbackNumber uintptr |
| 23 | 29 |
|
| 24 |
- logctx logrus.Fields |
|
| 25 |
- |
|
| 26 | 30 |
closedWaitOnce sync.Once |
| 27 | 31 |
waitBlock chan struct{}
|
| 32 |
+ exitCode int |
|
| 28 | 33 |
waitError error |
| 29 | 34 |
} |
| 30 | 35 |
|
| 31 |
-func newProcess(process hcsProcess, processID int, computeSystem *System) *Process {
|
|
| 36 |
+func newProcess(process vmcompute.HcsProcess, processID int, computeSystem *System) *Process {
|
|
| 32 | 37 |
return &Process{
|
| 33 | 38 |
handle: process, |
| 34 | 39 |
processID: processID, |
| 35 | 40 |
system: computeSystem, |
| 36 |
- logctx: logrus.Fields{
|
|
| 37 |
- logfields.ContainerID: computeSystem.ID(), |
|
| 38 |
- logfields.ProcessID: processID, |
|
| 39 |
- }, |
|
| 40 | 41 |
waitBlock: make(chan struct{}),
|
| 41 | 42 |
} |
| 42 | 43 |
} |
| 43 | 44 |
|
| 44 |
-type cachedPipes struct {
|
|
| 45 |
- stdIn syscall.Handle |
|
| 46 |
- stdOut syscall.Handle |
|
| 47 |
- stdErr syscall.Handle |
|
| 48 |
-} |
|
| 49 |
- |
|
| 50 | 45 |
type processModifyRequest struct {
|
| 51 | 46 |
Operation string |
| 52 | 47 |
ConsoleSize *consoleSize `json:",omitempty"` |
| ... | ... |
@@ -62,7 +57,7 @@ type closeHandle struct {
|
| 62 | 62 |
Handle string |
| 63 | 63 |
} |
| 64 | 64 |
|
| 65 |
-type ProcessStatus struct {
|
|
| 65 |
+type processStatus struct {
|
|
| 66 | 66 |
ProcessID uint32 |
| 67 | 67 |
Exited bool |
| 68 | 68 |
ExitCode uint32 |
| ... | ... |
@@ -90,24 +85,32 @@ func (process *Process) SystemID() string {
|
| 90 | 90 |
return process.system.ID() |
| 91 | 91 |
} |
| 92 | 92 |
|
| 93 |
-func (process *Process) logOperationBegin(operation string) {
|
|
| 94 |
- logOperationBegin( |
|
| 95 |
- process.logctx, |
|
| 96 |
- operation+" - Begin Operation") |
|
| 97 |
-} |
|
| 98 |
- |
|
| 99 |
-func (process *Process) logOperationEnd(operation string, err error) {
|
|
| 100 |
- var result string |
|
| 101 |
- if err == nil {
|
|
| 102 |
- result = "Success" |
|
| 103 |
- } else {
|
|
| 104 |
- result = "Error" |
|
| 93 |
+func (process *Process) processSignalResult(ctx context.Context, err error) (bool, error) {
|
|
| 94 |
+ switch err {
|
|
| 95 |
+ case nil: |
|
| 96 |
+ return true, nil |
|
| 97 |
+ case ErrVmcomputeOperationInvalidState, ErrComputeSystemDoesNotExist, ErrElementNotFound: |
|
| 98 |
+ select {
|
|
| 99 |
+ case <-process.waitBlock: |
|
| 100 |
+ // The process exit notification has already arrived. |
|
| 101 |
+ default: |
|
| 102 |
+ // The process should be gone, but we have not received the notification. |
|
| 103 |
+ // After a second, force unblock the process wait to work around a possible |
|
| 104 |
+ // deadlock in the HCS. |
|
| 105 |
+ go func() {
|
|
| 106 |
+ time.Sleep(time.Second) |
|
| 107 |
+ process.closedWaitOnce.Do(func() {
|
|
| 108 |
+ log.G(ctx).WithError(err).Warn("force unblocking process waits")
|
|
| 109 |
+ process.exitCode = -1 |
|
| 110 |
+ process.waitError = err |
|
| 111 |
+ close(process.waitBlock) |
|
| 112 |
+ }) |
|
| 113 |
+ }() |
|
| 114 |
+ } |
|
| 115 |
+ return false, nil |
|
| 116 |
+ default: |
|
| 117 |
+ return false, err |
|
| 105 | 118 |
} |
| 106 |
- |
|
| 107 |
- logOperationEnd( |
|
| 108 |
- process.logctx, |
|
| 109 |
- operation+" - End Operation - "+result, |
|
| 110 |
- err) |
|
| 111 | 119 |
} |
| 112 | 120 |
|
| 113 | 121 |
// Signal signals the process with `options`. |
| ... | ... |
@@ -115,115 +118,120 @@ func (process *Process) logOperationEnd(operation string, err error) {
|
| 115 | 115 |
// For LCOW `guestrequest.SignalProcessOptionsLCOW`. |
| 116 | 116 |
// |
| 117 | 117 |
// For WCOW `guestrequest.SignalProcessOptionsWCOW`. |
| 118 |
-func (process *Process) Signal(options interface{}) (err error) {
|
|
| 118 |
+func (process *Process) Signal(ctx context.Context, options interface{}) (bool, error) {
|
|
| 119 | 119 |
process.handleLock.RLock() |
| 120 | 120 |
defer process.handleLock.RUnlock() |
| 121 | 121 |
|
| 122 | 122 |
operation := "hcsshim::Process::Signal" |
| 123 |
- process.logOperationBegin(operation) |
|
| 124 |
- defer func() { process.logOperationEnd(operation, err) }()
|
|
| 125 | 123 |
|
| 126 | 124 |
if process.handle == 0 {
|
| 127 |
- return makeProcessError(process, operation, ErrAlreadyClosed, nil) |
|
| 125 |
+ return false, makeProcessError(process, operation, ErrAlreadyClosed, nil) |
|
| 128 | 126 |
} |
| 129 | 127 |
|
| 130 | 128 |
optionsb, err := json.Marshal(options) |
| 131 | 129 |
if err != nil {
|
| 132 |
- return err |
|
| 130 |
+ return false, err |
|
| 133 | 131 |
} |
| 134 | 132 |
|
| 135 |
- optionsStr := string(optionsb) |
|
| 136 |
- |
|
| 137 |
- var resultp *uint16 |
|
| 138 |
- syscallWatcher(process.logctx, func() {
|
|
| 139 |
- err = hcsSignalProcess(process.handle, optionsStr, &resultp) |
|
| 140 |
- }) |
|
| 141 |
- events := processHcsResult(resultp) |
|
| 133 |
+ resultJSON, err := vmcompute.HcsSignalProcess(ctx, process.handle, string(optionsb)) |
|
| 134 |
+ events := processHcsResult(ctx, resultJSON) |
|
| 135 |
+ delivered, err := process.processSignalResult(ctx, err) |
|
| 142 | 136 |
if err != nil {
|
| 143 |
- return makeProcessError(process, operation, err, events) |
|
| 137 |
+ err = makeProcessError(process, operation, err, events) |
|
| 144 | 138 |
} |
| 145 |
- |
|
| 146 |
- return nil |
|
| 139 |
+ return delivered, err |
|
| 147 | 140 |
} |
| 148 | 141 |
|
| 149 | 142 |
// Kill signals the process to terminate but does not wait for it to finish terminating. |
| 150 |
-func (process *Process) Kill() (err error) {
|
|
| 143 |
+func (process *Process) Kill(ctx context.Context) (bool, error) {
|
|
| 151 | 144 |
process.handleLock.RLock() |
| 152 | 145 |
defer process.handleLock.RUnlock() |
| 153 | 146 |
|
| 154 | 147 |
operation := "hcsshim::Process::Kill" |
| 155 |
- process.logOperationBegin(operation) |
|
| 156 |
- defer func() { process.logOperationEnd(operation, err) }()
|
|
| 157 | 148 |
|
| 158 | 149 |
if process.handle == 0 {
|
| 159 |
- return makeProcessError(process, operation, ErrAlreadyClosed, nil) |
|
| 150 |
+ return false, makeProcessError(process, operation, ErrAlreadyClosed, nil) |
|
| 160 | 151 |
} |
| 161 | 152 |
|
| 162 |
- var resultp *uint16 |
|
| 163 |
- syscallWatcher(process.logctx, func() {
|
|
| 164 |
- err = hcsTerminateProcess(process.handle, &resultp) |
|
| 165 |
- }) |
|
| 166 |
- events := processHcsResult(resultp) |
|
| 153 |
+ resultJSON, err := vmcompute.HcsTerminateProcess(ctx, process.handle) |
|
| 154 |
+ events := processHcsResult(ctx, resultJSON) |
|
| 155 |
+ delivered, err := process.processSignalResult(ctx, err) |
|
| 167 | 156 |
if err != nil {
|
| 168 |
- return makeProcessError(process, operation, err, events) |
|
| 157 |
+ err = makeProcessError(process, operation, err, events) |
|
| 169 | 158 |
} |
| 170 |
- |
|
| 171 |
- return nil |
|
| 159 |
+ return delivered, err |
|
| 172 | 160 |
} |
| 173 | 161 |
|
| 174 | 162 |
// waitBackground waits for the process exit notification. Once received sets |
| 175 |
-// `process.waitError` (if any) and unblocks all `Wait` and `WaitTimeout` calls. |
|
| 163 |
+// `process.waitError` (if any) and unblocks all `Wait` calls. |
|
| 176 | 164 |
// |
| 177 |
-// This MUST be called exactly once per `process.handle` but `Wait` and |
|
| 178 |
-// `WaitTimeout` are safe to call multiple times. |
|
| 165 |
+// This MUST be called exactly once per `process.handle` but `Wait` is safe to |
|
| 166 |
+// call multiple times. |
|
| 179 | 167 |
func (process *Process) waitBackground() {
|
| 180 |
- process.waitError = waitForNotification(process.callbackNumber, hcsNotificationProcessExited, nil) |
|
| 168 |
+ operation := "hcsshim::Process::waitBackground" |
|
| 169 |
+ ctx, span := trace.StartSpan(context.Background(), operation) |
|
| 170 |
+ defer span.End() |
|
| 171 |
+ span.AddAttributes( |
|
| 172 |
+ trace.StringAttribute("cid", process.SystemID()),
|
|
| 173 |
+ trace.Int64Attribute("pid", int64(process.processID)))
|
|
| 174 |
+ |
|
| 175 |
+ var ( |
|
| 176 |
+ err error |
|
| 177 |
+ exitCode = -1 |
|
| 178 |
+ ) |
|
| 179 |
+ |
|
| 180 |
+ err = waitForNotification(ctx, process.callbackNumber, hcsNotificationProcessExited, nil) |
|
| 181 |
+ if err != nil {
|
|
| 182 |
+ err = makeProcessError(process, operation, err, nil) |
|
| 183 |
+ log.G(ctx).WithError(err).Error("failed wait")
|
|
| 184 |
+ } else {
|
|
| 185 |
+ process.handleLock.RLock() |
|
| 186 |
+ defer process.handleLock.RUnlock() |
|
| 187 |
+ |
|
| 188 |
+ // Make sure we didnt race with Close() here |
|
| 189 |
+ if process.handle != 0 {
|
|
| 190 |
+ propertiesJSON, resultJSON, err := vmcompute.HcsGetProcessProperties(ctx, process.handle) |
|
| 191 |
+ events := processHcsResult(ctx, resultJSON) |
|
| 192 |
+ if err != nil {
|
|
| 193 |
+ err = makeProcessError(process, operation, err, events) |
|
| 194 |
+ } else {
|
|
| 195 |
+ properties := &processStatus{}
|
|
| 196 |
+ err = json.Unmarshal([]byte(propertiesJSON), properties) |
|
| 197 |
+ if err != nil {
|
|
| 198 |
+ err = makeProcessError(process, operation, err, nil) |
|
| 199 |
+ } else {
|
|
| 200 |
+ if properties.LastWaitResult != 0 {
|
|
| 201 |
+ log.G(ctx).WithField("wait-result", properties.LastWaitResult).Warning("non-zero last wait result")
|
|
| 202 |
+ } else {
|
|
| 203 |
+ exitCode = int(properties.ExitCode) |
|
| 204 |
+ } |
|
| 205 |
+ } |
|
| 206 |
+ } |
|
| 207 |
+ } |
|
| 208 |
+ } |
|
| 209 |
+ log.G(ctx).WithField("exitCode", exitCode).Debug("process exited")
|
|
| 210 |
+ |
|
| 181 | 211 |
process.closedWaitOnce.Do(func() {
|
| 212 |
+ process.exitCode = exitCode |
|
| 213 |
+ process.waitError = err |
|
| 182 | 214 |
close(process.waitBlock) |
| 183 | 215 |
}) |
| 216 |
+ oc.SetSpanStatus(span, err) |
|
| 184 | 217 |
} |
| 185 | 218 |
|
| 186 | 219 |
// Wait waits for the process to exit. If the process has already exited returns |
| 187 | 220 |
// the pervious error (if any). |
| 188 |
-func (process *Process) Wait() (err error) {
|
|
| 189 |
- operation := "hcsshim::Process::Wait" |
|
| 190 |
- process.logOperationBegin(operation) |
|
| 191 |
- defer func() { process.logOperationEnd(operation, err) }()
|
|
| 192 |
- |
|
| 221 |
+func (process *Process) Wait() error {
|
|
| 193 | 222 |
<-process.waitBlock |
| 194 |
- if process.waitError != nil {
|
|
| 195 |
- return makeProcessError(process, operation, process.waitError, nil) |
|
| 196 |
- } |
|
| 197 |
- return nil |
|
| 198 |
-} |
|
| 199 |
- |
|
| 200 |
-// WaitTimeout waits for the process to exit or the duration to elapse. If the |
|
| 201 |
-// process has already exited returns the pervious error (if any). If a timeout |
|
| 202 |
-// occurs returns `ErrTimeout`. |
|
| 203 |
-func (process *Process) WaitTimeout(timeout time.Duration) (err error) {
|
|
| 204 |
- operation := "hcssshim::Process::WaitTimeout" |
|
| 205 |
- process.logOperationBegin(operation) |
|
| 206 |
- defer func() { process.logOperationEnd(operation, err) }()
|
|
| 207 |
- |
|
| 208 |
- select {
|
|
| 209 |
- case <-process.waitBlock: |
|
| 210 |
- if process.waitError != nil {
|
|
| 211 |
- return makeProcessError(process, operation, process.waitError, nil) |
|
| 212 |
- } |
|
| 213 |
- return nil |
|
| 214 |
- case <-time.After(timeout): |
|
| 215 |
- return makeProcessError(process, operation, ErrTimeout, nil) |
|
| 216 |
- } |
|
| 223 |
+ return process.waitError |
|
| 217 | 224 |
} |
| 218 | 225 |
|
| 219 | 226 |
// ResizeConsole resizes the console of the process. |
| 220 |
-func (process *Process) ResizeConsole(width, height uint16) (err error) {
|
|
| 227 |
+func (process *Process) ResizeConsole(ctx context.Context, width, height uint16) error {
|
|
| 221 | 228 |
process.handleLock.RLock() |
| 222 | 229 |
defer process.handleLock.RUnlock() |
| 223 | 230 |
|
| 224 | 231 |
operation := "hcsshim::Process::ResizeConsole" |
| 225 |
- process.logOperationBegin(operation) |
|
| 226 |
- defer func() { process.logOperationEnd(operation, err) }()
|
|
| 227 | 232 |
|
| 228 | 233 |
if process.handle == 0 {
|
| 229 | 234 |
return makeProcessError(process, operation, ErrAlreadyClosed, nil) |
| ... | ... |
@@ -242,11 +250,8 @@ func (process *Process) ResizeConsole(width, height uint16) (err error) {
|
| 242 | 242 |
return err |
| 243 | 243 |
} |
| 244 | 244 |
|
| 245 |
- modifyRequestStr := string(modifyRequestb) |
|
| 246 |
- |
|
| 247 |
- var resultp *uint16 |
|
| 248 |
- err = hcsModifyProcess(process.handle, modifyRequestStr, &resultp) |
|
| 249 |
- events := processHcsResult(resultp) |
|
| 245 |
+ resultJSON, err := vmcompute.HcsModifyProcess(ctx, process.handle, string(modifyRequestb)) |
|
| 246 |
+ events := processHcsResult(ctx, resultJSON) |
|
| 250 | 247 |
if err != nil {
|
| 251 | 248 |
return makeProcessError(process, operation, err, events) |
| 252 | 249 |
} |
| ... | ... |
@@ -254,109 +259,55 @@ func (process *Process) ResizeConsole(width, height uint16) (err error) {
|
| 254 | 254 |
return nil |
| 255 | 255 |
} |
| 256 | 256 |
|
| 257 |
-func (process *Process) Properties() (_ *ProcessStatus, err error) {
|
|
| 258 |
- process.handleLock.RLock() |
|
| 259 |
- defer process.handleLock.RUnlock() |
|
| 260 |
- |
|
| 261 |
- operation := "hcsshim::Process::Properties" |
|
| 262 |
- process.logOperationBegin(operation) |
|
| 263 |
- defer func() { process.logOperationEnd(operation, err) }()
|
|
| 264 |
- |
|
| 265 |
- if process.handle == 0 {
|
|
| 266 |
- return nil, makeProcessError(process, operation, ErrAlreadyClosed, nil) |
|
| 267 |
- } |
|
| 268 |
- |
|
| 269 |
- var ( |
|
| 270 |
- resultp *uint16 |
|
| 271 |
- propertiesp *uint16 |
|
| 272 |
- ) |
|
| 273 |
- syscallWatcher(process.logctx, func() {
|
|
| 274 |
- err = hcsGetProcessProperties(process.handle, &propertiesp, &resultp) |
|
| 275 |
- }) |
|
| 276 |
- events := processHcsResult(resultp) |
|
| 277 |
- if err != nil {
|
|
| 278 |
- return nil, makeProcessError(process, operation, err, events) |
|
| 279 |
- } |
|
| 280 |
- |
|
| 281 |
- if propertiesp == nil {
|
|
| 282 |
- return nil, ErrUnexpectedValue |
|
| 283 |
- } |
|
| 284 |
- propertiesRaw := interop.ConvertAndFreeCoTaskMemBytes(propertiesp) |
|
| 285 |
- |
|
| 286 |
- properties := &ProcessStatus{}
|
|
| 287 |
- if err := json.Unmarshal(propertiesRaw, properties); err != nil {
|
|
| 288 |
- return nil, makeProcessError(process, operation, err, nil) |
|
| 289 |
- } |
|
| 290 |
- |
|
| 291 |
- return properties, nil |
|
| 292 |
-} |
|
| 293 |
- |
|
| 294 | 257 |
// ExitCode returns the exit code of the process. The process must have |
| 295 | 258 |
// already terminated. |
| 296 |
-func (process *Process) ExitCode() (_ int, err error) {
|
|
| 297 |
- operation := "hcsshim::Process::ExitCode" |
|
| 298 |
- process.logOperationBegin(operation) |
|
| 299 |
- defer func() { process.logOperationEnd(operation, err) }()
|
|
| 300 |
- |
|
| 301 |
- properties, err := process.Properties() |
|
| 302 |
- if err != nil {
|
|
| 303 |
- return -1, makeProcessError(process, operation, err, nil) |
|
| 304 |
- } |
|
| 305 |
- |
|
| 306 |
- if properties.Exited == false {
|
|
| 307 |
- return -1, makeProcessError(process, operation, ErrInvalidProcessState, nil) |
|
| 308 |
- } |
|
| 309 |
- |
|
| 310 |
- if properties.LastWaitResult != 0 {
|
|
| 311 |
- logrus.WithFields(logrus.Fields{
|
|
| 312 |
- logfields.ContainerID: process.SystemID(), |
|
| 313 |
- logfields.ProcessID: process.processID, |
|
| 314 |
- "wait-result": properties.LastWaitResult, |
|
| 315 |
- }).Warn("hcsshim::Process::ExitCode - Non-zero last wait result")
|
|
| 316 |
- return -1, nil |
|
| 259 |
+func (process *Process) ExitCode() (int, error) {
|
|
| 260 |
+ select {
|
|
| 261 |
+ case <-process.waitBlock: |
|
| 262 |
+ if process.waitError != nil {
|
|
| 263 |
+ return -1, process.waitError |
|
| 264 |
+ } |
|
| 265 |
+ return process.exitCode, nil |
|
| 266 |
+ default: |
|
| 267 |
+ return -1, makeProcessError(process, "hcsshim::Process::ExitCode", ErrInvalidProcessState, nil) |
|
| 317 | 268 |
} |
| 318 |
- |
|
| 319 |
- return int(properties.ExitCode), nil |
|
| 320 | 269 |
} |
| 321 | 270 |
|
| 322 |
-// Stdio returns the stdin, stdout, and stderr pipes, respectively. Closing |
|
| 323 |
-// these pipes does not close the underlying pipes; it should be possible to |
|
| 324 |
-// call this multiple times to get multiple interfaces. |
|
| 325 |
-func (process *Process) Stdio() (_ io.WriteCloser, _ io.ReadCloser, _ io.ReadCloser, err error) {
|
|
| 271 |
+// StdioLegacy returns the stdin, stdout, and stderr pipes, respectively. Closing |
|
| 272 |
+// these pipes does not close the underlying pipes. Once returned, these pipes |
|
| 273 |
+// are the responsibility of the caller to close. |
|
| 274 |
+func (process *Process) StdioLegacy() (_ io.WriteCloser, _ io.ReadCloser, _ io.ReadCloser, err error) {
|
|
| 275 |
+ operation := "hcsshim::Process::StdioLegacy" |
|
| 276 |
+ ctx, span := trace.StartSpan(context.Background(), operation) |
|
| 277 |
+ defer span.End() |
|
| 278 |
+ defer func() { oc.SetSpanStatus(span, err) }()
|
|
| 279 |
+ span.AddAttributes( |
|
| 280 |
+ trace.StringAttribute("cid", process.SystemID()),
|
|
| 281 |
+ trace.Int64Attribute("pid", int64(process.processID)))
|
|
| 282 |
+ |
|
| 326 | 283 |
process.handleLock.RLock() |
| 327 | 284 |
defer process.handleLock.RUnlock() |
| 328 | 285 |
|
| 329 |
- operation := "hcsshim::Process::Stdio" |
|
| 330 |
- process.logOperationBegin(operation) |
|
| 331 |
- defer func() { process.logOperationEnd(operation, err) }()
|
|
| 332 |
- |
|
| 333 | 286 |
if process.handle == 0 {
|
| 334 | 287 |
return nil, nil, nil, makeProcessError(process, operation, ErrAlreadyClosed, nil) |
| 335 | 288 |
} |
| 336 | 289 |
|
| 337 |
- var stdIn, stdOut, stdErr syscall.Handle |
|
| 338 |
- |
|
| 339 |
- if process.cachedPipes == nil {
|
|
| 340 |
- var ( |
|
| 341 |
- processInfo hcsProcessInformation |
|
| 342 |
- resultp *uint16 |
|
| 343 |
- ) |
|
| 344 |
- err = hcsGetProcessInfo(process.handle, &processInfo, &resultp) |
|
| 345 |
- events := processHcsResult(resultp) |
|
| 346 |
- if err != nil {
|
|
| 347 |
- return nil, nil, nil, makeProcessError(process, operation, err, events) |
|
| 348 |
- } |
|
| 349 |
- |
|
| 350 |
- stdIn, stdOut, stdErr = processInfo.StdInput, processInfo.StdOutput, processInfo.StdError |
|
| 351 |
- } else {
|
|
| 352 |
- // Use cached pipes |
|
| 353 |
- stdIn, stdOut, stdErr = process.cachedPipes.stdIn, process.cachedPipes.stdOut, process.cachedPipes.stdErr |
|
| 290 |
+ process.stdioLock.Lock() |
|
| 291 |
+ defer process.stdioLock.Unlock() |
|
| 292 |
+ if process.hasCachedStdio {
|
|
| 293 |
+ stdin, stdout, stderr := process.stdin, process.stdout, process.stderr |
|
| 294 |
+ process.stdin, process.stdout, process.stderr = nil, nil, nil |
|
| 295 |
+ process.hasCachedStdio = false |
|
| 296 |
+ return stdin, stdout, stderr, nil |
|
| 297 |
+ } |
|
| 354 | 298 |
|
| 355 |
- // Invalidate the cache |
|
| 356 |
- process.cachedPipes = nil |
|
| 299 |
+ processInfo, resultJSON, err := vmcompute.HcsGetProcessInfo(ctx, process.handle) |
|
| 300 |
+ events := processHcsResult(ctx, resultJSON) |
|
| 301 |
+ if err != nil {
|
|
| 302 |
+ return nil, nil, nil, makeProcessError(process, operation, err, events) |
|
| 357 | 303 |
} |
| 358 | 304 |
|
| 359 |
- pipes, err := makeOpenFiles([]syscall.Handle{stdIn, stdOut, stdErr})
|
|
| 305 |
+ pipes, err := makeOpenFiles([]syscall.Handle{processInfo.StdInput, processInfo.StdOutput, processInfo.StdError})
|
|
| 360 | 306 |
if err != nil {
|
| 361 | 307 |
return nil, nil, nil, makeProcessError(process, operation, err, nil) |
| 362 | 308 |
} |
| ... | ... |
@@ -364,15 +315,21 @@ func (process *Process) Stdio() (_ io.WriteCloser, _ io.ReadCloser, _ io.ReadClo |
| 364 | 364 |
return pipes[0], pipes[1], pipes[2], nil |
| 365 | 365 |
} |
| 366 | 366 |
|
| 367 |
+// Stdio returns the stdin, stdout, and stderr pipes, respectively. |
|
| 368 |
+// To close them, close the process handle. |
|
| 369 |
+func (process *Process) Stdio() (stdin io.Writer, stdout, stderr io.Reader) {
|
|
| 370 |
+ process.stdioLock.Lock() |
|
| 371 |
+ defer process.stdioLock.Unlock() |
|
| 372 |
+ return process.stdin, process.stdout, process.stderr |
|
| 373 |
+} |
|
| 374 |
+ |
|
| 367 | 375 |
// CloseStdin closes the write side of the stdin pipe so that the process is |
| 368 | 376 |
// notified on the read side that there is no more data in stdin. |
| 369 |
-func (process *Process) CloseStdin() (err error) {
|
|
| 377 |
+func (process *Process) CloseStdin(ctx context.Context) error {
|
|
| 370 | 378 |
process.handleLock.RLock() |
| 371 | 379 |
defer process.handleLock.RUnlock() |
| 372 | 380 |
|
| 373 | 381 |
operation := "hcsshim::Process::CloseStdin" |
| 374 |
- process.logOperationBegin(operation) |
|
| 375 |
- defer func() { process.logOperationEnd(operation, err) }()
|
|
| 376 | 382 |
|
| 377 | 383 |
if process.handle == 0 {
|
| 378 | 384 |
return makeProcessError(process, operation, ErrAlreadyClosed, nil) |
| ... | ... |
@@ -390,51 +347,76 @@ func (process *Process) CloseStdin() (err error) {
|
| 390 | 390 |
return err |
| 391 | 391 |
} |
| 392 | 392 |
|
| 393 |
- modifyRequestStr := string(modifyRequestb) |
|
| 394 |
- |
|
| 395 |
- var resultp *uint16 |
|
| 396 |
- err = hcsModifyProcess(process.handle, modifyRequestStr, &resultp) |
|
| 397 |
- events := processHcsResult(resultp) |
|
| 393 |
+ resultJSON, err := vmcompute.HcsModifyProcess(ctx, process.handle, string(modifyRequestb)) |
|
| 394 |
+ events := processHcsResult(ctx, resultJSON) |
|
| 398 | 395 |
if err != nil {
|
| 399 | 396 |
return makeProcessError(process, operation, err, events) |
| 400 | 397 |
} |
| 401 | 398 |
|
| 399 |
+ process.stdioLock.Lock() |
|
| 400 |
+ if process.stdin != nil {
|
|
| 401 |
+ process.stdin.Close() |
|
| 402 |
+ process.stdin = nil |
|
| 403 |
+ } |
|
| 404 |
+ process.stdioLock.Unlock() |
|
| 405 |
+ |
|
| 402 | 406 |
return nil |
| 403 | 407 |
} |
| 404 | 408 |
|
| 405 | 409 |
// Close cleans up any state associated with the process but does not kill |
| 406 | 410 |
// or wait on it. |
| 407 | 411 |
func (process *Process) Close() (err error) {
|
| 412 |
+ operation := "hcsshim::Process::Close" |
|
| 413 |
+ ctx, span := trace.StartSpan(context.Background(), operation) |
|
| 414 |
+ defer span.End() |
|
| 415 |
+ defer func() { oc.SetSpanStatus(span, err) }()
|
|
| 416 |
+ span.AddAttributes( |
|
| 417 |
+ trace.StringAttribute("cid", process.SystemID()),
|
|
| 418 |
+ trace.Int64Attribute("pid", int64(process.processID)))
|
|
| 419 |
+ |
|
| 408 | 420 |
process.handleLock.Lock() |
| 409 | 421 |
defer process.handleLock.Unlock() |
| 410 | 422 |
|
| 411 |
- operation := "hcsshim::Process::Close" |
|
| 412 |
- process.logOperationBegin(operation) |
|
| 413 |
- defer func() { process.logOperationEnd(operation, err) }()
|
|
| 414 |
- |
|
| 415 | 423 |
// Don't double free this |
| 416 | 424 |
if process.handle == 0 {
|
| 417 | 425 |
return nil |
| 418 | 426 |
} |
| 419 | 427 |
|
| 420 |
- if err = process.unregisterCallback(); err != nil {
|
|
| 428 |
+ process.stdioLock.Lock() |
|
| 429 |
+ if process.stdin != nil {
|
|
| 430 |
+ process.stdin.Close() |
|
| 431 |
+ process.stdin = nil |
|
| 432 |
+ } |
|
| 433 |
+ if process.stdout != nil {
|
|
| 434 |
+ process.stdout.Close() |
|
| 435 |
+ process.stdout = nil |
|
| 436 |
+ } |
|
| 437 |
+ if process.stderr != nil {
|
|
| 438 |
+ process.stderr.Close() |
|
| 439 |
+ process.stderr = nil |
|
| 440 |
+ } |
|
| 441 |
+ process.stdioLock.Unlock() |
|
| 442 |
+ |
|
| 443 |
+ if err = process.unregisterCallback(ctx); err != nil {
|
|
| 421 | 444 |
return makeProcessError(process, operation, err, nil) |
| 422 | 445 |
} |
| 423 | 446 |
|
| 424 |
- if err = hcsCloseProcess(process.handle); err != nil {
|
|
| 447 |
+ if err = vmcompute.HcsCloseProcess(ctx, process.handle); err != nil {
|
|
| 425 | 448 |
return makeProcessError(process, operation, err, nil) |
| 426 | 449 |
} |
| 427 | 450 |
|
| 428 | 451 |
process.handle = 0 |
| 429 | 452 |
process.closedWaitOnce.Do(func() {
|
| 453 |
+ process.exitCode = -1 |
|
| 454 |
+ process.waitError = ErrAlreadyClosed |
|
| 430 | 455 |
close(process.waitBlock) |
| 431 | 456 |
}) |
| 432 | 457 |
|
| 433 | 458 |
return nil |
| 434 | 459 |
} |
| 435 | 460 |
|
| 436 |
-func (process *Process) registerCallback() error {
|
|
| 437 |
- context := ¬ifcationWatcherContext{
|
|
| 461 |
+func (process *Process) registerCallback(ctx context.Context) error {
|
|
| 462 |
+ callbackContext := ¬ifcationWatcherContext{
|
|
| 438 | 463 |
channels: newProcessChannels(), |
| 439 | 464 |
systemID: process.SystemID(), |
| 440 | 465 |
processID: process.processID, |
| ... | ... |
@@ -443,45 +425,44 @@ func (process *Process) registerCallback() error {
|
| 443 | 443 |
callbackMapLock.Lock() |
| 444 | 444 |
callbackNumber := nextCallback |
| 445 | 445 |
nextCallback++ |
| 446 |
- callbackMap[callbackNumber] = context |
|
| 446 |
+ callbackMap[callbackNumber] = callbackContext |
|
| 447 | 447 |
callbackMapLock.Unlock() |
| 448 | 448 |
|
| 449 |
- var callbackHandle hcsCallback |
|
| 450 |
- err := hcsRegisterProcessCallback(process.handle, notificationWatcherCallback, callbackNumber, &callbackHandle) |
|
| 449 |
+ callbackHandle, err := vmcompute.HcsRegisterProcessCallback(ctx, process.handle, notificationWatcherCallback, callbackNumber) |
|
| 451 | 450 |
if err != nil {
|
| 452 | 451 |
return err |
| 453 | 452 |
} |
| 454 |
- context.handle = callbackHandle |
|
| 453 |
+ callbackContext.handle = callbackHandle |
|
| 455 | 454 |
process.callbackNumber = callbackNumber |
| 456 | 455 |
|
| 457 | 456 |
return nil |
| 458 | 457 |
} |
| 459 | 458 |
|
| 460 |
-func (process *Process) unregisterCallback() error {
|
|
| 459 |
+func (process *Process) unregisterCallback(ctx context.Context) error {
|
|
| 461 | 460 |
callbackNumber := process.callbackNumber |
| 462 | 461 |
|
| 463 | 462 |
callbackMapLock.RLock() |
| 464 |
- context := callbackMap[callbackNumber] |
|
| 463 |
+ callbackContext := callbackMap[callbackNumber] |
|
| 465 | 464 |
callbackMapLock.RUnlock() |
| 466 | 465 |
|
| 467 |
- if context == nil {
|
|
| 466 |
+ if callbackContext == nil {
|
|
| 468 | 467 |
return nil |
| 469 | 468 |
} |
| 470 | 469 |
|
| 471 |
- handle := context.handle |
|
| 470 |
+ handle := callbackContext.handle |
|
| 472 | 471 |
|
| 473 | 472 |
if handle == 0 {
|
| 474 | 473 |
return nil |
| 475 | 474 |
} |
| 476 | 475 |
|
| 477 |
- // hcsUnregisterProcessCallback has its own syncronization |
|
| 478 |
- // to wait for all callbacks to complete. We must NOT hold the callbackMapLock. |
|
| 479 |
- err := hcsUnregisterProcessCallback(handle) |
|
| 476 |
+ // vmcompute.HcsUnregisterProcessCallback has its own synchronization to |
|
| 477 |
+ // wait for all callbacks to complete. We must NOT hold the callbackMapLock. |
|
| 478 |
+ err := vmcompute.HcsUnregisterProcessCallback(ctx, handle) |
|
| 480 | 479 |
if err != nil {
|
| 481 | 480 |
return err |
| 482 | 481 |
} |
| 483 | 482 |
|
| 484 |
- closeChannels(context.channels) |
|
| 483 |
+ closeChannels(callbackContext.channels) |
|
| 485 | 484 |
|
| 486 | 485 |
callbackMapLock.Lock() |
| 487 | 486 |
delete(callbackMap, callbackNumber) |
| ... | ... |
@@ -1,18 +1,24 @@ |
| 1 | 1 |
package hcs |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "context" |
|
| 4 | 5 |
"encoding/json" |
| 6 |
+ "errors" |
|
| 5 | 7 |
"os" |
| 6 | 8 |
"strconv" |
| 9 |
+ "strings" |
|
| 7 | 10 |
"sync" |
| 8 | 11 |
"syscall" |
| 9 | 12 |
"time" |
| 10 | 13 |
|
| 11 |
- "github.com/Microsoft/hcsshim/internal/interop" |
|
| 12 |
- "github.com/Microsoft/hcsshim/internal/logfields" |
|
| 14 |
+ "github.com/Microsoft/hcsshim/internal/cow" |
|
| 15 |
+ "github.com/Microsoft/hcsshim/internal/log" |
|
| 16 |
+ "github.com/Microsoft/hcsshim/internal/oc" |
|
| 13 | 17 |
"github.com/Microsoft/hcsshim/internal/schema1" |
| 18 |
+ hcsschema "github.com/Microsoft/hcsshim/internal/schema2" |
|
| 14 | 19 |
"github.com/Microsoft/hcsshim/internal/timeout" |
| 15 |
- "github.com/sirupsen/logrus" |
|
| 20 |
+ "github.com/Microsoft/hcsshim/internal/vmcompute" |
|
| 21 |
+ "go.opencensus.io/trace" |
|
| 16 | 22 |
) |
| 17 | 23 |
|
| 18 | 24 |
// currentContainerStarts is used to limit the number of concurrent container |
| ... | ... |
@@ -38,54 +44,37 @@ func init() {
|
| 38 | 38 |
|
| 39 | 39 |
type System struct {
|
| 40 | 40 |
handleLock sync.RWMutex |
| 41 |
- handle hcsSystem |
|
| 41 |
+ handle vmcompute.HcsSystem |
|
| 42 | 42 |
id string |
| 43 | 43 |
callbackNumber uintptr |
| 44 | 44 |
|
| 45 |
- logctx logrus.Fields |
|
| 46 |
- |
|
| 47 | 45 |
closedWaitOnce sync.Once |
| 48 | 46 |
waitBlock chan struct{}
|
| 49 | 47 |
waitError error |
| 48 |
+ exitError error |
|
| 49 |
+ |
|
| 50 |
+ os, typ string |
|
| 50 | 51 |
} |
| 51 | 52 |
|
| 52 | 53 |
func newSystem(id string) *System {
|
| 53 | 54 |
return &System{
|
| 54 |
- id: id, |
|
| 55 |
- logctx: logrus.Fields{
|
|
| 56 |
- logfields.ContainerID: id, |
|
| 57 |
- }, |
|
| 55 |
+ id: id, |
|
| 58 | 56 |
waitBlock: make(chan struct{}),
|
| 59 | 57 |
} |
| 60 | 58 |
} |
| 61 | 59 |
|
| 62 |
-func (computeSystem *System) logOperationBegin(operation string) {
|
|
| 63 |
- logOperationBegin( |
|
| 64 |
- computeSystem.logctx, |
|
| 65 |
- operation+" - Begin Operation") |
|
| 66 |
-} |
|
| 67 |
- |
|
| 68 |
-func (computeSystem *System) logOperationEnd(operation string, err error) {
|
|
| 69 |
- var result string |
|
| 70 |
- if err == nil {
|
|
| 71 |
- result = "Success" |
|
| 72 |
- } else {
|
|
| 73 |
- result = "Error" |
|
| 74 |
- } |
|
| 75 |
- |
|
| 76 |
- logOperationEnd( |
|
| 77 |
- computeSystem.logctx, |
|
| 78 |
- operation+" - End Operation - "+result, |
|
| 79 |
- err) |
|
| 80 |
-} |
|
| 81 |
- |
|
| 82 | 60 |
// CreateComputeSystem creates a new compute system with the given configuration but does not start it. |
| 83 |
-func CreateComputeSystem(id string, hcsDocumentInterface interface{}) (_ *System, err error) {
|
|
| 61 |
+func CreateComputeSystem(ctx context.Context, id string, hcsDocumentInterface interface{}) (_ *System, err error) {
|
|
| 84 | 62 |
operation := "hcsshim::CreateComputeSystem" |
| 85 | 63 |
|
| 64 |
+ // hcsCreateComputeSystemContext is an async operation. Start the outer span |
|
| 65 |
+ // here to measure the full create time. |
|
| 66 |
+ ctx, span := trace.StartSpan(ctx, operation) |
|
| 67 |
+ defer span.End() |
|
| 68 |
+ defer func() { oc.SetSpanStatus(span, err) }()
|
|
| 69 |
+ span.AddAttributes(trace.StringAttribute("cid", id))
|
|
| 70 |
+ |
|
| 86 | 71 |
computeSystem := newSystem(id) |
| 87 |
- computeSystem.logOperationBegin(operation) |
|
| 88 |
- defer func() { computeSystem.logOperationEnd(operation, err) }()
|
|
| 89 | 72 |
|
| 90 | 73 |
hcsDocumentB, err := json.Marshal(hcsDocumentInterface) |
| 91 | 74 |
if err != nil {
|
| ... | ... |
@@ -94,129 +83,114 @@ func CreateComputeSystem(id string, hcsDocumentInterface interface{}) (_ *System
|
| 94 | 94 |
|
| 95 | 95 |
hcsDocument := string(hcsDocumentB) |
| 96 | 96 |
|
| 97 |
- logrus.WithFields(computeSystem.logctx). |
|
| 98 |
- WithField(logfields.JSON, hcsDocument). |
|
| 99 |
- Debug("HCS ComputeSystem Document")
|
|
| 100 |
- |
|
| 101 | 97 |
var ( |
| 102 |
- resultp *uint16 |
|
| 103 | 98 |
identity syscall.Handle |
| 99 |
+ resultJSON string |
|
| 104 | 100 |
createError error |
| 105 | 101 |
) |
| 106 |
- syscallWatcher(computeSystem.logctx, func() {
|
|
| 107 |
- createError = hcsCreateComputeSystem(id, hcsDocument, identity, &computeSystem.handle, &resultp) |
|
| 108 |
- }) |
|
| 109 |
- |
|
| 102 |
+ computeSystem.handle, resultJSON, createError = vmcompute.HcsCreateComputeSystem(ctx, id, hcsDocument, identity) |
|
| 110 | 103 |
if createError == nil || IsPending(createError) {
|
| 111 |
- if err = computeSystem.registerCallback(); err != nil {
|
|
| 104 |
+ defer func() {
|
|
| 105 |
+ if err != nil {
|
|
| 106 |
+ computeSystem.Close() |
|
| 107 |
+ } |
|
| 108 |
+ }() |
|
| 109 |
+ if err = computeSystem.registerCallback(ctx); err != nil {
|
|
| 112 | 110 |
// Terminate the compute system if it still exists. We're okay to |
| 113 | 111 |
// ignore a failure here. |
| 114 |
- computeSystem.Terminate() |
|
| 112 |
+ computeSystem.Terminate(ctx) |
|
| 115 | 113 |
return nil, makeSystemError(computeSystem, operation, "", err, nil) |
| 116 | 114 |
} |
| 117 | 115 |
} |
| 118 | 116 |
|
| 119 |
- events, err := processAsyncHcsResult(createError, resultp, computeSystem.callbackNumber, hcsNotificationSystemCreateCompleted, &timeout.SystemCreate) |
|
| 117 |
+ events, err := processAsyncHcsResult(ctx, createError, resultJSON, computeSystem.callbackNumber, hcsNotificationSystemCreateCompleted, &timeout.SystemCreate) |
|
| 120 | 118 |
if err != nil {
|
| 121 | 119 |
if err == ErrTimeout {
|
| 122 | 120 |
// Terminate the compute system if it still exists. We're okay to |
| 123 | 121 |
// ignore a failure here. |
| 124 |
- computeSystem.Terminate() |
|
| 122 |
+ computeSystem.Terminate(ctx) |
|
| 125 | 123 |
} |
| 126 | 124 |
return nil, makeSystemError(computeSystem, operation, hcsDocument, err, events) |
| 127 | 125 |
} |
| 128 |
- |
|
| 129 | 126 |
go computeSystem.waitBackground() |
| 130 |
- |
|
| 127 |
+ if err = computeSystem.getCachedProperties(ctx); err != nil {
|
|
| 128 |
+ return nil, err |
|
| 129 |
+ } |
|
| 131 | 130 |
return computeSystem, nil |
| 132 | 131 |
} |
| 133 | 132 |
|
| 134 | 133 |
// OpenComputeSystem opens an existing compute system by ID. |
| 135 |
-func OpenComputeSystem(id string) (_ *System, err error) {
|
|
| 134 |
+func OpenComputeSystem(ctx context.Context, id string) (*System, error) {
|
|
| 136 | 135 |
operation := "hcsshim::OpenComputeSystem" |
| 137 | 136 |
|
| 138 | 137 |
computeSystem := newSystem(id) |
| 139 |
- computeSystem.logOperationBegin(operation) |
|
| 140 |
- defer func() {
|
|
| 141 |
- if IsNotExist(err) {
|
|
| 142 |
- computeSystem.logOperationEnd(operation, nil) |
|
| 143 |
- } else {
|
|
| 144 |
- computeSystem.logOperationEnd(operation, err) |
|
| 145 |
- } |
|
| 146 |
- }() |
|
| 147 |
- |
|
| 148 |
- var ( |
|
| 149 |
- handle hcsSystem |
|
| 150 |
- resultp *uint16 |
|
| 151 |
- ) |
|
| 152 |
- err = hcsOpenComputeSystem(id, &handle, &resultp) |
|
| 153 |
- events := processHcsResult(resultp) |
|
| 138 |
+ handle, resultJSON, err := vmcompute.HcsOpenComputeSystem(ctx, id) |
|
| 139 |
+ events := processHcsResult(ctx, resultJSON) |
|
| 154 | 140 |
if err != nil {
|
| 155 | 141 |
return nil, makeSystemError(computeSystem, operation, "", err, events) |
| 156 | 142 |
} |
| 157 |
- |
|
| 158 | 143 |
computeSystem.handle = handle |
| 159 |
- |
|
| 160 |
- if err = computeSystem.registerCallback(); err != nil {
|
|
| 144 |
+ defer func() {
|
|
| 145 |
+ if err != nil {
|
|
| 146 |
+ computeSystem.Close() |
|
| 147 |
+ } |
|
| 148 |
+ }() |
|
| 149 |
+ if err = computeSystem.registerCallback(ctx); err != nil {
|
|
| 161 | 150 |
return nil, makeSystemError(computeSystem, operation, "", err, nil) |
| 162 | 151 |
} |
| 163 | 152 |
go computeSystem.waitBackground() |
| 164 |
- |
|
| 153 |
+ if err = computeSystem.getCachedProperties(ctx); err != nil {
|
|
| 154 |
+ return nil, err |
|
| 155 |
+ } |
|
| 165 | 156 |
return computeSystem, nil |
| 166 | 157 |
} |
| 167 | 158 |
|
| 168 |
-// GetComputeSystems gets a list of the compute systems on the system that match the query |
|
| 169 |
-func GetComputeSystems(q schema1.ComputeSystemQuery) (_ []schema1.ContainerProperties, err error) {
|
|
| 170 |
- operation := "hcsshim::GetComputeSystems" |
|
| 171 |
- fields := logrus.Fields{}
|
|
| 172 |
- logOperationBegin( |
|
| 173 |
- fields, |
|
| 174 |
- operation+" - Begin Operation") |
|
| 159 |
+func (computeSystem *System) getCachedProperties(ctx context.Context) error {
|
|
| 160 |
+ props, err := computeSystem.Properties(ctx) |
|
| 161 |
+ if err != nil {
|
|
| 162 |
+ return err |
|
| 163 |
+ } |
|
| 164 |
+ computeSystem.typ = strings.ToLower(props.SystemType) |
|
| 165 |
+ computeSystem.os = strings.ToLower(props.RuntimeOSType) |
|
| 166 |
+ if computeSystem.os == "" && computeSystem.typ == "container" {
|
|
| 167 |
+ // Pre-RS5 HCS did not return the OS, but it only supported containers |
|
| 168 |
+ // that ran Windows. |
|
| 169 |
+ computeSystem.os = "windows" |
|
| 170 |
+ } |
|
| 171 |
+ return nil |
|
| 172 |
+} |
|
| 175 | 173 |
|
| 176 |
- defer func() {
|
|
| 177 |
- var result string |
|
| 178 |
- if err == nil {
|
|
| 179 |
- result = "Success" |
|
| 180 |
- } else {
|
|
| 181 |
- result = "Error" |
|
| 182 |
- } |
|
| 174 |
+// OS returns the operating system of the compute system, "linux" or "windows". |
|
| 175 |
+func (computeSystem *System) OS() string {
|
|
| 176 |
+ return computeSystem.os |
|
| 177 |
+} |
|
| 183 | 178 |
|
| 184 |
- logOperationEnd( |
|
| 185 |
- fields, |
|
| 186 |
- operation+" - End Operation - "+result, |
|
| 187 |
- err) |
|
| 188 |
- }() |
|
| 179 |
+// IsOCI returns whether processes in the compute system should be created via |
|
| 180 |
+// OCI. |
|
| 181 |
+func (computeSystem *System) IsOCI() bool {
|
|
| 182 |
+ return computeSystem.os == "linux" && computeSystem.typ == "container" |
|
| 183 |
+} |
|
| 184 |
+ |
|
| 185 |
+// GetComputeSystems gets a list of the compute systems on the system that match the query |
|
| 186 |
+func GetComputeSystems(ctx context.Context, q schema1.ComputeSystemQuery) ([]schema1.ContainerProperties, error) {
|
|
| 187 |
+ operation := "hcsshim::GetComputeSystems" |
|
| 189 | 188 |
|
| 190 | 189 |
queryb, err := json.Marshal(q) |
| 191 | 190 |
if err != nil {
|
| 192 | 191 |
return nil, err |
| 193 | 192 |
} |
| 194 | 193 |
|
| 195 |
- query := string(queryb) |
|
| 196 |
- |
|
| 197 |
- logrus.WithFields(fields). |
|
| 198 |
- WithField(logfields.JSON, query). |
|
| 199 |
- Debug("HCS ComputeSystem Query")
|
|
| 200 |
- |
|
| 201 |
- var ( |
|
| 202 |
- resultp *uint16 |
|
| 203 |
- computeSystemsp *uint16 |
|
| 204 |
- ) |
|
| 205 |
- |
|
| 206 |
- syscallWatcher(fields, func() {
|
|
| 207 |
- err = hcsEnumerateComputeSystems(query, &computeSystemsp, &resultp) |
|
| 208 |
- }) |
|
| 209 |
- events := processHcsResult(resultp) |
|
| 194 |
+ computeSystemsJSON, resultJSON, err := vmcompute.HcsEnumerateComputeSystems(ctx, string(queryb)) |
|
| 195 |
+ events := processHcsResult(ctx, resultJSON) |
|
| 210 | 196 |
if err != nil {
|
| 211 | 197 |
return nil, &HcsError{Op: operation, Err: err, Events: events}
|
| 212 | 198 |
} |
| 213 | 199 |
|
| 214 |
- if computeSystemsp == nil {
|
|
| 200 |
+ if computeSystemsJSON == "" {
|
|
| 215 | 201 |
return nil, ErrUnexpectedValue |
| 216 | 202 |
} |
| 217 |
- computeSystemsRaw := interop.ConvertAndFreeCoTaskMemBytes(computeSystemsp) |
|
| 218 | 203 |
computeSystems := []schema1.ContainerProperties{}
|
| 219 |
- if err = json.Unmarshal(computeSystemsRaw, &computeSystems); err != nil {
|
|
| 204 |
+ if err = json.Unmarshal([]byte(computeSystemsJSON), &computeSystems); err != nil {
|
|
| 220 | 205 |
return nil, err |
| 221 | 206 |
} |
| 222 | 207 |
|
| ... | ... |
@@ -224,16 +198,21 @@ func GetComputeSystems(q schema1.ComputeSystemQuery) (_ []schema1.ContainerPrope |
| 224 | 224 |
} |
| 225 | 225 |
|
| 226 | 226 |
// Start synchronously starts the computeSystem. |
| 227 |
-func (computeSystem *System) Start() (err error) {
|
|
| 227 |
+func (computeSystem *System) Start(ctx context.Context) (err error) {
|
|
| 228 |
+ operation := "hcsshim::System::Start" |
|
| 229 |
+ |
|
| 230 |
+ // hcsStartComputeSystemContext is an async operation. Start the outer span |
|
| 231 |
+ // here to measure the full start time. |
|
| 232 |
+ ctx, span := trace.StartSpan(ctx, operation) |
|
| 233 |
+ defer span.End() |
|
| 234 |
+ defer func() { oc.SetSpanStatus(span, err) }()
|
|
| 235 |
+ span.AddAttributes(trace.StringAttribute("cid", computeSystem.id))
|
|
| 236 |
+ |
|
| 228 | 237 |
computeSystem.handleLock.RLock() |
| 229 | 238 |
defer computeSystem.handleLock.RUnlock() |
| 230 | 239 |
|
| 231 |
- operation := "hcsshim::ComputeSystem::Start" |
|
| 232 |
- computeSystem.logOperationBegin(operation) |
|
| 233 |
- defer func() { computeSystem.logOperationEnd(operation, err) }()
|
|
| 234 |
- |
|
| 235 | 240 |
if computeSystem.handle == 0 {
|
| 236 |
- return makeSystemError(computeSystem, "Start", "", ErrAlreadyClosed, nil) |
|
| 241 |
+ return makeSystemError(computeSystem, operation, "", ErrAlreadyClosed, nil) |
|
| 237 | 242 |
} |
| 238 | 243 |
|
| 239 | 244 |
// This is a very simple backoff-retry loop to limit the number |
| ... | ... |
@@ -262,13 +241,10 @@ func (computeSystem *System) Start() (err error) {
|
| 262 | 262 |
}() |
| 263 | 263 |
} |
| 264 | 264 |
|
| 265 |
- var resultp *uint16 |
|
| 266 |
- syscallWatcher(computeSystem.logctx, func() {
|
|
| 267 |
- err = hcsStartComputeSystem(computeSystem.handle, "", &resultp) |
|
| 268 |
- }) |
|
| 269 |
- events, err := processAsyncHcsResult(err, resultp, computeSystem.callbackNumber, hcsNotificationSystemStartCompleted, &timeout.SystemStart) |
|
| 265 |
+ resultJSON, err := vmcompute.HcsStartComputeSystem(ctx, computeSystem.handle, "") |
|
| 266 |
+ events, err := processAsyncHcsResult(ctx, err, resultJSON, computeSystem.callbackNumber, hcsNotificationSystemStartCompleted, &timeout.SystemStart) |
|
| 270 | 267 |
if err != nil {
|
| 271 |
- return makeSystemError(computeSystem, "Start", "", err, events) |
|
| 268 |
+ return makeSystemError(computeSystem, operation, "", err, events) |
|
| 272 | 269 |
} |
| 273 | 270 |
|
| 274 | 271 |
return nil |
| ... | ... |
@@ -279,273 +255,257 @@ func (computeSystem *System) ID() string {
|
| 279 | 279 |
return computeSystem.id |
| 280 | 280 |
} |
| 281 | 281 |
|
| 282 |
-// Shutdown requests a compute system shutdown, if IsPending() on the error returned is true, |
|
| 283 |
-// it may not actually be shut down until Wait() succeeds. |
|
| 284 |
-func (computeSystem *System) Shutdown() (err error) {
|
|
| 282 |
+// Shutdown requests a compute system shutdown. |
|
| 283 |
+func (computeSystem *System) Shutdown(ctx context.Context) error {
|
|
| 285 | 284 |
computeSystem.handleLock.RLock() |
| 286 | 285 |
defer computeSystem.handleLock.RUnlock() |
| 287 | 286 |
|
| 288 |
- operation := "hcsshim::ComputeSystem::Shutdown" |
|
| 289 |
- computeSystem.logOperationBegin(operation) |
|
| 290 |
- defer func() {
|
|
| 291 |
- if IsAlreadyClosed(err) || IsAlreadyStopped(err) || IsPending(err) {
|
|
| 292 |
- computeSystem.logOperationEnd(operation, nil) |
|
| 293 |
- } else {
|
|
| 294 |
- computeSystem.logOperationEnd(operation, err) |
|
| 295 |
- } |
|
| 296 |
- }() |
|
| 287 |
+ operation := "hcsshim::System::Shutdown" |
|
| 297 | 288 |
|
| 298 | 289 |
if computeSystem.handle == 0 {
|
| 299 |
- return makeSystemError(computeSystem, "Shutdown", "", ErrAlreadyClosed, nil) |
|
| 290 |
+ return nil |
|
| 300 | 291 |
} |
| 301 | 292 |
|
| 302 |
- var resultp *uint16 |
|
| 303 |
- syscallWatcher(computeSystem.logctx, func() {
|
|
| 304 |
- err = hcsShutdownComputeSystem(computeSystem.handle, "", &resultp) |
|
| 305 |
- }) |
|
| 306 |
- events := processHcsResult(resultp) |
|
| 307 |
- if err != nil {
|
|
| 308 |
- return makeSystemError(computeSystem, "Shutdown", "", err, events) |
|
| 293 |
+ resultJSON, err := vmcompute.HcsShutdownComputeSystem(ctx, computeSystem.handle, "") |
|
| 294 |
+ events := processHcsResult(ctx, resultJSON) |
|
| 295 |
+ switch err {
|
|
| 296 |
+ case nil, ErrVmcomputeAlreadyStopped, ErrComputeSystemDoesNotExist, ErrVmcomputeOperationPending: |
|
| 297 |
+ default: |
|
| 298 |
+ return makeSystemError(computeSystem, operation, "", err, events) |
|
| 309 | 299 |
} |
| 310 |
- |
|
| 311 | 300 |
return nil |
| 312 | 301 |
} |
| 313 | 302 |
|
| 314 |
-// Terminate requests a compute system terminate, if IsPending() on the error returned is true, |
|
| 315 |
-// it may not actually be shut down until Wait() succeeds. |
|
| 316 |
-func (computeSystem *System) Terminate() (err error) {
|
|
| 303 |
+// Terminate requests a compute system terminate. |
|
| 304 |
+func (computeSystem *System) Terminate(ctx context.Context) error {
|
|
| 317 | 305 |
computeSystem.handleLock.RLock() |
| 318 | 306 |
defer computeSystem.handleLock.RUnlock() |
| 319 | 307 |
|
| 320 |
- operation := "hcsshim::ComputeSystem::Terminate" |
|
| 321 |
- computeSystem.logOperationBegin(operation) |
|
| 322 |
- defer func() {
|
|
| 323 |
- if IsAlreadyClosed(err) || IsAlreadyStopped(err) || IsPending(err) {
|
|
| 324 |
- computeSystem.logOperationEnd(operation, nil) |
|
| 325 |
- } else {
|
|
| 326 |
- computeSystem.logOperationEnd(operation, err) |
|
| 327 |
- } |
|
| 328 |
- }() |
|
| 308 |
+ operation := "hcsshim::System::Terminate" |
|
| 329 | 309 |
|
| 330 | 310 |
if computeSystem.handle == 0 {
|
| 331 |
- return makeSystemError(computeSystem, "Terminate", "", ErrAlreadyClosed, nil) |
|
| 311 |
+ return nil |
|
| 332 | 312 |
} |
| 333 | 313 |
|
| 334 |
- var resultp *uint16 |
|
| 335 |
- syscallWatcher(computeSystem.logctx, func() {
|
|
| 336 |
- err = hcsTerminateComputeSystem(computeSystem.handle, "", &resultp) |
|
| 337 |
- }) |
|
| 338 |
- events := processHcsResult(resultp) |
|
| 339 |
- if err != nil && err != ErrVmcomputeAlreadyStopped {
|
|
| 340 |
- return makeSystemError(computeSystem, "Terminate", "", err, events) |
|
| 314 |
+ resultJSON, err := vmcompute.HcsTerminateComputeSystem(ctx, computeSystem.handle, "") |
|
| 315 |
+ events := processHcsResult(ctx, resultJSON) |
|
| 316 |
+ switch err {
|
|
| 317 |
+ case nil, ErrVmcomputeAlreadyStopped, ErrComputeSystemDoesNotExist, ErrVmcomputeOperationPending: |
|
| 318 |
+ default: |
|
| 319 |
+ return makeSystemError(computeSystem, operation, "", err, events) |
|
| 341 | 320 |
} |
| 342 |
- |
|
| 343 | 321 |
return nil |
| 344 | 322 |
} |
| 345 | 323 |
|
| 346 | 324 |
// waitBackground waits for the compute system exit notification. Once received |
| 347 |
-// sets `computeSystem.waitError` (if any) and unblocks all `Wait`, |
|
| 348 |
-// `WaitExpectedError`, and `WaitTimeout` calls. |
|
| 325 |
+// sets `computeSystem.waitError` (if any) and unblocks all `Wait` calls. |
|
| 349 | 326 |
// |
| 350 |
-// This MUST be called exactly once per `computeSystem.handle` but `Wait`, |
|
| 351 |
-// `WaitExpectedError`, and `WaitTimeout` are safe to call multiple times. |
|
| 327 |
+// This MUST be called exactly once per `computeSystem.handle` but `Wait` is |
|
| 328 |
+// safe to call multiple times. |
|
| 352 | 329 |
func (computeSystem *System) waitBackground() {
|
| 353 |
- computeSystem.waitError = waitForNotification(computeSystem.callbackNumber, hcsNotificationSystemExited, nil) |
|
| 330 |
+ operation := "hcsshim::System::waitBackground" |
|
| 331 |
+ ctx, span := trace.StartSpan(context.Background(), operation) |
|
| 332 |
+ defer span.End() |
|
| 333 |
+ span.AddAttributes(trace.StringAttribute("cid", computeSystem.id))
|
|
| 334 |
+ |
|
| 335 |
+ err := waitForNotification(ctx, computeSystem.callbackNumber, hcsNotificationSystemExited, nil) |
|
| 336 |
+ switch err {
|
|
| 337 |
+ case nil: |
|
| 338 |
+ log.G(ctx).Debug("system exited")
|
|
| 339 |
+ case ErrVmcomputeUnexpectedExit: |
|
| 340 |
+ log.G(ctx).Debug("unexpected system exit")
|
|
| 341 |
+ computeSystem.exitError = makeSystemError(computeSystem, operation, "", err, nil) |
|
| 342 |
+ err = nil |
|
| 343 |
+ default: |
|
| 344 |
+ err = makeSystemError(computeSystem, operation, "", err, nil) |
|
| 345 |
+ } |
|
| 354 | 346 |
computeSystem.closedWaitOnce.Do(func() {
|
| 347 |
+ computeSystem.waitError = err |
|
| 355 | 348 |
close(computeSystem.waitBlock) |
| 356 | 349 |
}) |
| 350 |
+ oc.SetSpanStatus(span, err) |
|
| 357 | 351 |
} |
| 358 | 352 |
|
| 359 | 353 |
// Wait synchronously waits for the compute system to shutdown or terminate. If |
| 360 | 354 |
// the compute system has already exited returns the previous error (if any). |
| 361 |
-func (computeSystem *System) Wait() (err error) {
|
|
| 362 |
- operation := "hcsshim::ComputeSystem::Wait" |
|
| 363 |
- computeSystem.logOperationBegin(operation) |
|
| 364 |
- defer func() { computeSystem.logOperationEnd(operation, err) }()
|
|
| 365 |
- |
|
| 366 |
- <-computeSystem.waitBlock |
|
| 367 |
- if computeSystem.waitError != nil {
|
|
| 368 |
- return makeSystemError(computeSystem, "Wait", "", computeSystem.waitError, nil) |
|
| 369 |
- } |
|
| 370 |
- |
|
| 371 |
- return nil |
|
| 372 |
-} |
|
| 373 |
- |
|
| 374 |
-// WaitExpectedError synchronously waits for the compute system to shutdown or |
|
| 375 |
-// terminate and returns the error (if any) as long as it does not match |
|
| 376 |
-// `expected`. If the compute system has already exited returns the previous |
|
| 377 |
-// error (if any) as long as it does not match `expected`. |
|
| 378 |
-func (computeSystem *System) WaitExpectedError(expected error) (err error) {
|
|
| 379 |
- operation := "hcsshim::ComputeSystem::WaitExpectedError" |
|
| 380 |
- computeSystem.logOperationBegin(operation) |
|
| 381 |
- defer func() { computeSystem.logOperationEnd(operation, err) }()
|
|
| 382 |
- |
|
| 355 |
+func (computeSystem *System) Wait() error {
|
|
| 383 | 356 |
<-computeSystem.waitBlock |
| 384 |
- if computeSystem.waitError != nil && getInnerError(computeSystem.waitError) != expected {
|
|
| 385 |
- return makeSystemError(computeSystem, "WaitExpectedError", "", computeSystem.waitError, nil) |
|
| 386 |
- } |
|
| 387 |
- return nil |
|
| 357 |
+ return computeSystem.waitError |
|
| 388 | 358 |
} |
| 389 | 359 |
|
| 390 |
-// WaitTimeout synchronously waits for the compute system to terminate or the |
|
| 391 |
-// duration to elapse. If the timeout expires, `IsTimeout(err) == true`. If |
|
| 392 |
-// the compute system has already exited returns the previous error (if any). |
|
| 393 |
-func (computeSystem *System) WaitTimeout(timeout time.Duration) (err error) {
|
|
| 394 |
- operation := "hcsshim::ComputeSystem::WaitTimeout" |
|
| 395 |
- computeSystem.logOperationBegin(operation) |
|
| 396 |
- defer func() { computeSystem.logOperationEnd(operation, err) }()
|
|
| 397 |
- |
|
| 360 |
+// ExitError returns an error describing the reason the compute system terminated. |
|
| 361 |
+func (computeSystem *System) ExitError() error {
|
|
| 398 | 362 |
select {
|
| 399 | 363 |
case <-computeSystem.waitBlock: |
| 400 | 364 |
if computeSystem.waitError != nil {
|
| 401 |
- return makeSystemError(computeSystem, "WaitTimeout", "", computeSystem.waitError, nil) |
|
| 365 |
+ return computeSystem.waitError |
|
| 402 | 366 |
} |
| 403 |
- return nil |
|
| 404 |
- case <-time.After(timeout): |
|
| 405 |
- return makeSystemError(computeSystem, "WaitTimeout", "", ErrTimeout, nil) |
|
| 367 |
+ return computeSystem.exitError |
|
| 368 |
+ default: |
|
| 369 |
+ return errors.New("container not exited")
|
|
| 406 | 370 |
} |
| 407 | 371 |
} |
| 408 | 372 |
|
| 409 |
-func (computeSystem *System) Properties(types ...schema1.PropertyType) (_ *schema1.ContainerProperties, err error) {
|
|
| 373 |
+// Properties returns the requested container properties targeting a V1 schema container. |
|
| 374 |
+func (computeSystem *System) Properties(ctx context.Context, types ...schema1.PropertyType) (*schema1.ContainerProperties, error) {
|
|
| 410 | 375 |
computeSystem.handleLock.RLock() |
| 411 | 376 |
defer computeSystem.handleLock.RUnlock() |
| 412 | 377 |
|
| 413 |
- operation := "hcsshim::ComputeSystem::Properties" |
|
| 414 |
- computeSystem.logOperationBegin(operation) |
|
| 415 |
- defer func() { computeSystem.logOperationEnd(operation, err) }()
|
|
| 378 |
+ operation := "hcsshim::System::Properties" |
|
| 416 | 379 |
|
| 417 | 380 |
queryBytes, err := json.Marshal(schema1.PropertyQuery{PropertyTypes: types})
|
| 418 | 381 |
if err != nil {
|
| 419 |
- return nil, makeSystemError(computeSystem, "Properties", "", err, nil) |
|
| 382 |
+ return nil, makeSystemError(computeSystem, operation, "", err, nil) |
|
| 420 | 383 |
} |
| 421 | 384 |
|
| 422 |
- queryString := string(queryBytes) |
|
| 423 |
- logrus.WithFields(computeSystem.logctx). |
|
| 424 |
- WithField(logfields.JSON, queryString). |
|
| 425 |
- Debug("HCS ComputeSystem Properties Query")
|
|
| 426 |
- |
|
| 427 |
- var resultp, propertiesp *uint16 |
|
| 428 |
- syscallWatcher(computeSystem.logctx, func() {
|
|
| 429 |
- err = hcsGetComputeSystemProperties(computeSystem.handle, string(queryString), &propertiesp, &resultp) |
|
| 430 |
- }) |
|
| 431 |
- events := processHcsResult(resultp) |
|
| 385 |
+ propertiesJSON, resultJSON, err := vmcompute.HcsGetComputeSystemProperties(ctx, computeSystem.handle, string(queryBytes)) |
|
| 386 |
+ events := processHcsResult(ctx, resultJSON) |
|
| 432 | 387 |
if err != nil {
|
| 433 |
- return nil, makeSystemError(computeSystem, "Properties", "", err, events) |
|
| 388 |
+ return nil, makeSystemError(computeSystem, operation, "", err, events) |
|
| 434 | 389 |
} |
| 435 | 390 |
|
| 436 |
- if propertiesp == nil {
|
|
| 391 |
+ if propertiesJSON == "" {
|
|
| 437 | 392 |
return nil, ErrUnexpectedValue |
| 438 | 393 |
} |
| 439 |
- propertiesRaw := interop.ConvertAndFreeCoTaskMemBytes(propertiesp) |
|
| 440 | 394 |
properties := &schema1.ContainerProperties{}
|
| 441 |
- if err := json.Unmarshal(propertiesRaw, properties); err != nil {
|
|
| 442 |
- return nil, makeSystemError(computeSystem, "Properties", "", err, nil) |
|
| 395 |
+ if err := json.Unmarshal([]byte(propertiesJSON), properties); err != nil {
|
|
| 396 |
+ return nil, makeSystemError(computeSystem, operation, "", err, nil) |
|
| 443 | 397 |
} |
| 444 | 398 |
|
| 445 | 399 |
return properties, nil |
| 446 | 400 |
} |
| 447 | 401 |
|
| 448 |
-// Pause pauses the execution of the computeSystem. This feature is not enabled in TP5. |
|
| 449 |
-func (computeSystem *System) Pause() (err error) {
|
|
| 402 |
+// PropertiesV2 returns the requested container properties targeting a V2 schema container. |
|
| 403 |
+func (computeSystem *System) PropertiesV2(ctx context.Context, types ...hcsschema.PropertyType) (*hcsschema.Properties, error) {
|
|
| 450 | 404 |
computeSystem.handleLock.RLock() |
| 451 | 405 |
defer computeSystem.handleLock.RUnlock() |
| 452 | 406 |
|
| 453 |
- operation := "hcsshim::ComputeSystem::Pause" |
|
| 454 |
- computeSystem.logOperationBegin(operation) |
|
| 455 |
- defer func() { computeSystem.logOperationEnd(operation, err) }()
|
|
| 407 |
+ operation := "hcsshim::System::PropertiesV2" |
|
| 408 |
+ |
|
| 409 |
+ queryBytes, err := json.Marshal(hcsschema.PropertyQuery{PropertyTypes: types})
|
|
| 410 |
+ if err != nil {
|
|
| 411 |
+ return nil, makeSystemError(computeSystem, operation, "", err, nil) |
|
| 412 |
+ } |
|
| 413 |
+ |
|
| 414 |
+ propertiesJSON, resultJSON, err := vmcompute.HcsGetComputeSystemProperties(ctx, computeSystem.handle, string(queryBytes)) |
|
| 415 |
+ events := processHcsResult(ctx, resultJSON) |
|
| 416 |
+ if err != nil {
|
|
| 417 |
+ return nil, makeSystemError(computeSystem, operation, "", err, events) |
|
| 418 |
+ } |
|
| 419 |
+ |
|
| 420 |
+ if propertiesJSON == "" {
|
|
| 421 |
+ return nil, ErrUnexpectedValue |
|
| 422 |
+ } |
|
| 423 |
+ properties := &hcsschema.Properties{}
|
|
| 424 |
+ if err := json.Unmarshal([]byte(propertiesJSON), properties); err != nil {
|
|
| 425 |
+ return nil, makeSystemError(computeSystem, operation, "", err, nil) |
|
| 426 |
+ } |
|
| 427 |
+ |
|
| 428 |
+ return properties, nil |
|
| 429 |
+} |
|
| 430 |
+ |
|
| 431 |
+// Pause pauses the execution of the computeSystem. This feature is not enabled in TP5. |
|
| 432 |
+func (computeSystem *System) Pause(ctx context.Context) (err error) {
|
|
| 433 |
+ operation := "hcsshim::System::Pause" |
|
| 434 |
+ |
|
| 435 |
+ // hcsPauseComputeSystemContext is an async peration. Start the outer span |
|
| 436 |
+ // here to measure the full pause time. |
|
| 437 |
+ ctx, span := trace.StartSpan(ctx, operation) |
|
| 438 |
+ defer span.End() |
|
| 439 |
+ defer func() { oc.SetSpanStatus(span, err) }()
|
|
| 440 |
+ span.AddAttributes(trace.StringAttribute("cid", computeSystem.id))
|
|
| 441 |
+ |
|
| 442 |
+ computeSystem.handleLock.RLock() |
|
| 443 |
+ defer computeSystem.handleLock.RUnlock() |
|
| 456 | 444 |
|
| 457 | 445 |
if computeSystem.handle == 0 {
|
| 458 |
- return makeSystemError(computeSystem, "Pause", "", ErrAlreadyClosed, nil) |
|
| 446 |
+ return makeSystemError(computeSystem, operation, "", ErrAlreadyClosed, nil) |
|
| 459 | 447 |
} |
| 460 | 448 |
|
| 461 |
- var resultp *uint16 |
|
| 462 |
- syscallWatcher(computeSystem.logctx, func() {
|
|
| 463 |
- err = hcsPauseComputeSystem(computeSystem.handle, "", &resultp) |
|
| 464 |
- }) |
|
| 465 |
- events, err := processAsyncHcsResult(err, resultp, computeSystem.callbackNumber, hcsNotificationSystemPauseCompleted, &timeout.SystemPause) |
|
| 449 |
+ resultJSON, err := vmcompute.HcsPauseComputeSystem(ctx, computeSystem.handle, "") |
|
| 450 |
+ events, err := processAsyncHcsResult(ctx, err, resultJSON, computeSystem.callbackNumber, hcsNotificationSystemPauseCompleted, &timeout.SystemPause) |
|
| 466 | 451 |
if err != nil {
|
| 467 |
- return makeSystemError(computeSystem, "Pause", "", err, events) |
|
| 452 |
+ return makeSystemError(computeSystem, operation, "", err, events) |
|
| 468 | 453 |
} |
| 469 | 454 |
|
| 470 | 455 |
return nil |
| 471 | 456 |
} |
| 472 | 457 |
|
| 473 | 458 |
// Resume resumes the execution of the computeSystem. This feature is not enabled in TP5. |
| 474 |
-func (computeSystem *System) Resume() (err error) {
|
|
| 459 |
+func (computeSystem *System) Resume(ctx context.Context) (err error) {
|
|
| 460 |
+ operation := "hcsshim::System::Resume" |
|
| 461 |
+ |
|
| 462 |
+ // hcsResumeComputeSystemContext is an async operation. Start the outer span |
|
| 463 |
+ // here to measure the full restore time. |
|
| 464 |
+ ctx, span := trace.StartSpan(ctx, operation) |
|
| 465 |
+ defer span.End() |
|
| 466 |
+ defer func() { oc.SetSpanStatus(span, err) }()
|
|
| 467 |
+ span.AddAttributes(trace.StringAttribute("cid", computeSystem.id))
|
|
| 468 |
+ |
|
| 475 | 469 |
computeSystem.handleLock.RLock() |
| 476 | 470 |
defer computeSystem.handleLock.RUnlock() |
| 477 | 471 |
|
| 478 |
- operation := "hcsshim::ComputeSystem::Resume" |
|
| 479 |
- computeSystem.logOperationBegin(operation) |
|
| 480 |
- defer func() { computeSystem.logOperationEnd(operation, err) }()
|
|
| 481 |
- |
|
| 482 | 472 |
if computeSystem.handle == 0 {
|
| 483 |
- return makeSystemError(computeSystem, "Resume", "", ErrAlreadyClosed, nil) |
|
| 473 |
+ return makeSystemError(computeSystem, operation, "", ErrAlreadyClosed, nil) |
|
| 484 | 474 |
} |
| 485 | 475 |
|
| 486 |
- var resultp *uint16 |
|
| 487 |
- syscallWatcher(computeSystem.logctx, func() {
|
|
| 488 |
- err = hcsResumeComputeSystem(computeSystem.handle, "", &resultp) |
|
| 489 |
- }) |
|
| 490 |
- events, err := processAsyncHcsResult(err, resultp, computeSystem.callbackNumber, hcsNotificationSystemResumeCompleted, &timeout.SystemResume) |
|
| 476 |
+ resultJSON, err := vmcompute.HcsResumeComputeSystem(ctx, computeSystem.handle, "") |
|
| 477 |
+ events, err := processAsyncHcsResult(ctx, err, resultJSON, computeSystem.callbackNumber, hcsNotificationSystemResumeCompleted, &timeout.SystemResume) |
|
| 491 | 478 |
if err != nil {
|
| 492 |
- return makeSystemError(computeSystem, "Resume", "", err, events) |
|
| 479 |
+ return makeSystemError(computeSystem, operation, "", err, events) |
|
| 493 | 480 |
} |
| 494 | 481 |
|
| 495 | 482 |
return nil |
| 496 | 483 |
} |
| 497 | 484 |
|
| 498 |
-// CreateProcess launches a new process within the computeSystem. |
|
| 499 |
-func (computeSystem *System) CreateProcess(c interface{}) (_ *Process, err error) {
|
|
| 485 |
+func (computeSystem *System) createProcess(ctx context.Context, operation string, c interface{}) (*Process, *vmcompute.HcsProcessInformation, error) {
|
|
| 500 | 486 |
computeSystem.handleLock.RLock() |
| 501 | 487 |
defer computeSystem.handleLock.RUnlock() |
| 502 | 488 |
|
| 503 |
- operation := "hcsshim::ComputeSystem::CreateProcess" |
|
| 504 |
- computeSystem.logOperationBegin(operation) |
|
| 505 |
- defer func() { computeSystem.logOperationEnd(operation, err) }()
|
|
| 506 |
- |
|
| 507 |
- var ( |
|
| 508 |
- processInfo hcsProcessInformation |
|
| 509 |
- processHandle hcsProcess |
|
| 510 |
- resultp *uint16 |
|
| 511 |
- ) |
|
| 512 |
- |
|
| 513 | 489 |
if computeSystem.handle == 0 {
|
| 514 |
- return nil, makeSystemError(computeSystem, "CreateProcess", "", ErrAlreadyClosed, nil) |
|
| 490 |
+ return nil, nil, makeSystemError(computeSystem, operation, "", ErrAlreadyClosed, nil) |
|
| 515 | 491 |
} |
| 516 | 492 |
|
| 517 | 493 |
configurationb, err := json.Marshal(c) |
| 518 | 494 |
if err != nil {
|
| 519 |
- return nil, makeSystemError(computeSystem, "CreateProcess", "", err, nil) |
|
| 495 |
+ return nil, nil, makeSystemError(computeSystem, operation, "", err, nil) |
|
| 520 | 496 |
} |
| 521 | 497 |
|
| 522 | 498 |
configuration := string(configurationb) |
| 499 |
+ processInfo, processHandle, resultJSON, err := vmcompute.HcsCreateProcess(ctx, computeSystem.handle, configuration) |
|
| 500 |
+ events := processHcsResult(ctx, resultJSON) |
|
| 501 |
+ if err != nil {
|
|
| 502 |
+ return nil, nil, makeSystemError(computeSystem, operation, configuration, err, events) |
|
| 503 |
+ } |
|
| 523 | 504 |
|
| 524 |
- logrus.WithFields(computeSystem.logctx). |
|
| 525 |
- WithField(logfields.JSON, configuration). |
|
| 526 |
- Debug("HCS ComputeSystem Process Document")
|
|
| 505 |
+ log.G(ctx).WithField("pid", processInfo.ProcessId).Debug("created process pid")
|
|
| 506 |
+ return newProcess(processHandle, int(processInfo.ProcessId), computeSystem), &processInfo, nil |
|
| 507 |
+} |
|
| 527 | 508 |
|
| 528 |
- syscallWatcher(computeSystem.logctx, func() {
|
|
| 529 |
- err = hcsCreateProcess(computeSystem.handle, configuration, &processInfo, &processHandle, &resultp) |
|
| 530 |
- }) |
|
| 531 |
- events := processHcsResult(resultp) |
|
| 509 |
+// CreateProcess launches a new process within the computeSystem. |
|
| 510 |
+func (computeSystem *System) CreateProcess(ctx context.Context, c interface{}) (cow.Process, error) {
|
|
| 511 |
+ operation := "hcsshim::System::CreateProcess" |
|
| 512 |
+ process, processInfo, err := computeSystem.createProcess(ctx, operation, c) |
|
| 532 | 513 |
if err != nil {
|
| 533 |
- return nil, makeSystemError(computeSystem, "CreateProcess", configuration, err, events) |
|
| 514 |
+ return nil, err |
|
| 534 | 515 |
} |
| 516 |
+ defer func() {
|
|
| 517 |
+ if err != nil {
|
|
| 518 |
+ process.Close() |
|
| 519 |
+ } |
|
| 520 |
+ }() |
|
| 535 | 521 |
|
| 536 |
- logrus.WithFields(computeSystem.logctx). |
|
| 537 |
- WithField(logfields.ProcessID, processInfo.ProcessId). |
|
| 538 |
- Debug("HCS ComputeSystem CreateProcess PID")
|
|
| 539 |
- |
|
| 540 |
- process := newProcess(processHandle, int(processInfo.ProcessId), computeSystem) |
|
| 541 |
- process.cachedPipes = &cachedPipes{
|
|
| 542 |
- stdIn: processInfo.StdInput, |
|
| 543 |
- stdOut: processInfo.StdOutput, |
|
| 544 |
- stdErr: processInfo.StdError, |
|
| 522 |
+ pipes, err := makeOpenFiles([]syscall.Handle{processInfo.StdInput, processInfo.StdOutput, processInfo.StdError})
|
|
| 523 |
+ if err != nil {
|
|
| 524 |
+ return nil, makeSystemError(computeSystem, operation, "", err, nil) |
|
| 545 | 525 |
} |
| 526 |
+ process.stdin = pipes[0] |
|
| 527 |
+ process.stdout = pipes[1] |
|
| 528 |
+ process.stderr = pipes[2] |
|
| 529 |
+ process.hasCachedStdio = true |
|
| 546 | 530 |
|
| 547 |
- if err = process.registerCallback(); err != nil {
|
|
| 548 |
- return nil, makeSystemError(computeSystem, "CreateProcess", "", err, nil) |
|
| 531 |
+ if err = process.registerCallback(ctx); err != nil {
|
|
| 532 |
+ return nil, makeSystemError(computeSystem, operation, "", err, nil) |
|
| 549 | 533 |
} |
| 550 | 534 |
go process.waitBackground() |
| 551 | 535 |
|
| ... | ... |
@@ -553,38 +513,25 @@ func (computeSystem *System) CreateProcess(c interface{}) (_ *Process, err error
|
| 553 | 553 |
} |
| 554 | 554 |
|
| 555 | 555 |
// OpenProcess gets an interface to an existing process within the computeSystem. |
| 556 |
-func (computeSystem *System) OpenProcess(pid int) (_ *Process, err error) {
|
|
| 556 |
+func (computeSystem *System) OpenProcess(ctx context.Context, pid int) (*Process, error) {
|
|
| 557 | 557 |
computeSystem.handleLock.RLock() |
| 558 | 558 |
defer computeSystem.handleLock.RUnlock() |
| 559 | 559 |
|
| 560 |
- // Add PID for the context of this operation |
|
| 561 |
- computeSystem.logctx[logfields.ProcessID] = pid |
|
| 562 |
- defer delete(computeSystem.logctx, logfields.ProcessID) |
|
| 563 |
- |
|
| 564 |
- operation := "hcsshim::ComputeSystem::OpenProcess" |
|
| 565 |
- computeSystem.logOperationBegin(operation) |
|
| 566 |
- defer func() { computeSystem.logOperationEnd(operation, err) }()
|
|
| 567 |
- |
|
| 568 |
- var ( |
|
| 569 |
- processHandle hcsProcess |
|
| 570 |
- resultp *uint16 |
|
| 571 |
- ) |
|
| 560 |
+ operation := "hcsshim::System::OpenProcess" |
|
| 572 | 561 |
|
| 573 | 562 |
if computeSystem.handle == 0 {
|
| 574 |
- return nil, makeSystemError(computeSystem, "OpenProcess", "", ErrAlreadyClosed, nil) |
|
| 563 |
+ return nil, makeSystemError(computeSystem, operation, "", ErrAlreadyClosed, nil) |
|
| 575 | 564 |
} |
| 576 | 565 |
|
| 577 |
- syscallWatcher(computeSystem.logctx, func() {
|
|
| 578 |
- err = hcsOpenProcess(computeSystem.handle, uint32(pid), &processHandle, &resultp) |
|
| 579 |
- }) |
|
| 580 |
- events := processHcsResult(resultp) |
|
| 566 |
+ processHandle, resultJSON, err := vmcompute.HcsOpenProcess(ctx, computeSystem.handle, uint32(pid)) |
|
| 567 |
+ events := processHcsResult(ctx, resultJSON) |
|
| 581 | 568 |
if err != nil {
|
| 582 |
- return nil, makeSystemError(computeSystem, "OpenProcess", "", err, events) |
|
| 569 |
+ return nil, makeSystemError(computeSystem, operation, "", err, events) |
|
| 583 | 570 |
} |
| 584 | 571 |
|
| 585 | 572 |
process := newProcess(processHandle, pid, computeSystem) |
| 586 |
- if err = process.registerCallback(); err != nil {
|
|
| 587 |
- return nil, makeSystemError(computeSystem, "OpenProcess", "", err, nil) |
|
| 573 |
+ if err = process.registerCallback(ctx); err != nil {
|
|
| 574 |
+ return nil, makeSystemError(computeSystem, operation, "", err, nil) |
|
| 588 | 575 |
} |
| 589 | 576 |
go process.waitBackground() |
| 590 | 577 |
|
| ... | ... |
@@ -593,39 +540,40 @@ func (computeSystem *System) OpenProcess(pid int) (_ *Process, err error) {
|
| 593 | 593 |
|
| 594 | 594 |
// Close cleans up any state associated with the compute system but does not terminate or wait for it. |
| 595 | 595 |
func (computeSystem *System) Close() (err error) {
|
| 596 |
+ operation := "hcsshim::System::Close" |
|
| 597 |
+ ctx, span := trace.StartSpan(context.Background(), operation) |
|
| 598 |
+ defer span.End() |
|
| 599 |
+ defer func() { oc.SetSpanStatus(span, err) }()
|
|
| 600 |
+ span.AddAttributes(trace.StringAttribute("cid", computeSystem.id))
|
|
| 601 |
+ |
|
| 596 | 602 |
computeSystem.handleLock.Lock() |
| 597 | 603 |
defer computeSystem.handleLock.Unlock() |
| 598 | 604 |
|
| 599 |
- operation := "hcsshim::ComputeSystem::Close" |
|
| 600 |
- computeSystem.logOperationBegin(operation) |
|
| 601 |
- defer func() { computeSystem.logOperationEnd(operation, err) }()
|
|
| 602 |
- |
|
| 603 | 605 |
// Don't double free this |
| 604 | 606 |
if computeSystem.handle == 0 {
|
| 605 | 607 |
return nil |
| 606 | 608 |
} |
| 607 | 609 |
|
| 608 |
- if err = computeSystem.unregisterCallback(); err != nil {
|
|
| 609 |
- return makeSystemError(computeSystem, "Close", "", err, nil) |
|
| 610 |
+ if err = computeSystem.unregisterCallback(ctx); err != nil {
|
|
| 611 |
+ return makeSystemError(computeSystem, operation, "", err, nil) |
|
| 610 | 612 |
} |
| 611 | 613 |
|
| 612 |
- syscallWatcher(computeSystem.logctx, func() {
|
|
| 613 |
- err = hcsCloseComputeSystem(computeSystem.handle) |
|
| 614 |
- }) |
|
| 614 |
+ err = vmcompute.HcsCloseComputeSystem(ctx, computeSystem.handle) |
|
| 615 | 615 |
if err != nil {
|
| 616 |
- return makeSystemError(computeSystem, "Close", "", err, nil) |
|
| 616 |
+ return makeSystemError(computeSystem, operation, "", err, nil) |
|
| 617 | 617 |
} |
| 618 | 618 |
|
| 619 | 619 |
computeSystem.handle = 0 |
| 620 | 620 |
computeSystem.closedWaitOnce.Do(func() {
|
| 621 |
+ computeSystem.waitError = ErrAlreadyClosed |
|
| 621 | 622 |
close(computeSystem.waitBlock) |
| 622 | 623 |
}) |
| 623 | 624 |
|
| 624 | 625 |
return nil |
| 625 | 626 |
} |
| 626 | 627 |
|
| 627 |
-func (computeSystem *System) registerCallback() error {
|
|
| 628 |
- context := ¬ifcationWatcherContext{
|
|
| 628 |
+func (computeSystem *System) registerCallback(ctx context.Context) error {
|
|
| 629 |
+ callbackContext := ¬ifcationWatcherContext{
|
|
| 629 | 630 |
channels: newSystemChannels(), |
| 630 | 631 |
systemID: computeSystem.id, |
| 631 | 632 |
} |
| ... | ... |
@@ -633,32 +581,31 @@ func (computeSystem *System) registerCallback() error {
|
| 633 | 633 |
callbackMapLock.Lock() |
| 634 | 634 |
callbackNumber := nextCallback |
| 635 | 635 |
nextCallback++ |
| 636 |
- callbackMap[callbackNumber] = context |
|
| 636 |
+ callbackMap[callbackNumber] = callbackContext |
|
| 637 | 637 |
callbackMapLock.Unlock() |
| 638 | 638 |
|
| 639 |
- var callbackHandle hcsCallback |
|
| 640 |
- err := hcsRegisterComputeSystemCallback(computeSystem.handle, notificationWatcherCallback, callbackNumber, &callbackHandle) |
|
| 639 |
+ callbackHandle, err := vmcompute.HcsRegisterComputeSystemCallback(ctx, computeSystem.handle, notificationWatcherCallback, callbackNumber) |
|
| 641 | 640 |
if err != nil {
|
| 642 | 641 |
return err |
| 643 | 642 |
} |
| 644 |
- context.handle = callbackHandle |
|
| 643 |
+ callbackContext.handle = callbackHandle |
|
| 645 | 644 |
computeSystem.callbackNumber = callbackNumber |
| 646 | 645 |
|
| 647 | 646 |
return nil |
| 648 | 647 |
} |
| 649 | 648 |
|
| 650 |
-func (computeSystem *System) unregisterCallback() error {
|
|
| 649 |
+func (computeSystem *System) unregisterCallback(ctx context.Context) error {
|
|
| 651 | 650 |
callbackNumber := computeSystem.callbackNumber |
| 652 | 651 |
|
| 653 | 652 |
callbackMapLock.RLock() |
| 654 |
- context := callbackMap[callbackNumber] |
|
| 653 |
+ callbackContext := callbackMap[callbackNumber] |
|
| 655 | 654 |
callbackMapLock.RUnlock() |
| 656 | 655 |
|
| 657 |
- if context == nil {
|
|
| 656 |
+ if callbackContext == nil {
|
|
| 658 | 657 |
return nil |
| 659 | 658 |
} |
| 660 | 659 |
|
| 661 |
- handle := context.handle |
|
| 660 |
+ handle := callbackContext.handle |
|
| 662 | 661 |
|
| 663 | 662 |
if handle == 0 {
|
| 664 | 663 |
return nil |
| ... | ... |
@@ -666,12 +613,12 @@ func (computeSystem *System) unregisterCallback() error {
|
| 666 | 666 |
|
| 667 | 667 |
// hcsUnregisterComputeSystemCallback has its own syncronization |
| 668 | 668 |
// to wait for all callbacks to complete. We must NOT hold the callbackMapLock. |
| 669 |
- err := hcsUnregisterComputeSystemCallback(handle) |
|
| 669 |
+ err := vmcompute.HcsUnregisterComputeSystemCallback(ctx, handle) |
|
| 670 | 670 |
if err != nil {
|
| 671 | 671 |
return err |
| 672 | 672 |
} |
| 673 | 673 |
|
| 674 |
- closeChannels(context.channels) |
|
| 674 |
+ closeChannels(callbackContext.channels) |
|
| 675 | 675 |
|
| 676 | 676 |
callbackMapLock.Lock() |
| 677 | 677 |
delete(callbackMap, callbackNumber) |
| ... | ... |
@@ -683,36 +630,26 @@ func (computeSystem *System) unregisterCallback() error {
|
| 683 | 683 |
} |
| 684 | 684 |
|
| 685 | 685 |
// Modify the System by sending a request to HCS |
| 686 |
-func (computeSystem *System) Modify(config interface{}) (err error) {
|
|
| 686 |
+func (computeSystem *System) Modify(ctx context.Context, config interface{}) error {
|
|
| 687 | 687 |
computeSystem.handleLock.RLock() |
| 688 | 688 |
defer computeSystem.handleLock.RUnlock() |
| 689 | 689 |
|
| 690 |
- operation := "hcsshim::ComputeSystem::Modify" |
|
| 691 |
- computeSystem.logOperationBegin(operation) |
|
| 692 |
- defer func() { computeSystem.logOperationEnd(operation, err) }()
|
|
| 690 |
+ operation := "hcsshim::System::Modify" |
|
| 693 | 691 |
|
| 694 | 692 |
if computeSystem.handle == 0 {
|
| 695 |
- return makeSystemError(computeSystem, "Modify", "", ErrAlreadyClosed, nil) |
|
| 693 |
+ return makeSystemError(computeSystem, operation, "", ErrAlreadyClosed, nil) |
|
| 696 | 694 |
} |
| 697 | 695 |
|
| 698 |
- requestJSON, err := json.Marshal(config) |
|
| 696 |
+ requestBytes, err := json.Marshal(config) |
|
| 699 | 697 |
if err != nil {
|
| 700 | 698 |
return err |
| 701 | 699 |
} |
| 702 | 700 |
|
| 703 |
- requestString := string(requestJSON) |
|
| 704 |
- |
|
| 705 |
- logrus.WithFields(computeSystem.logctx). |
|
| 706 |
- WithField(logfields.JSON, requestString). |
|
| 707 |
- Debug("HCS ComputeSystem Modify Document")
|
|
| 708 |
- |
|
| 709 |
- var resultp *uint16 |
|
| 710 |
- syscallWatcher(computeSystem.logctx, func() {
|
|
| 711 |
- err = hcsModifyComputeSystem(computeSystem.handle, requestString, &resultp) |
|
| 712 |
- }) |
|
| 713 |
- events := processHcsResult(resultp) |
|
| 701 |
+ requestJSON := string(requestBytes) |
|
| 702 |
+ resultJSON, err := vmcompute.HcsModifyComputeSystem(ctx, computeSystem.handle, requestJSON) |
|
| 703 |
+ events := processHcsResult(ctx, resultJSON) |
|
| 714 | 704 |
if err != nil {
|
| 715 |
- return makeSystemError(computeSystem, "Modify", requestString, err, events) |
|
| 705 |
+ return makeSystemError(computeSystem, operation, requestJSON, err, events) |
|
| 716 | 706 |
} |
| 717 | 707 |
|
| 718 | 708 |
return nil |
| ... | ... |
@@ -1,25 +1,26 @@ |
| 1 | 1 |
package hcs |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "context" |
|
| 4 | 5 |
"time" |
| 5 | 6 |
|
| 6 |
- "github.com/sirupsen/logrus" |
|
| 7 |
+ "github.com/Microsoft/hcsshim/internal/log" |
|
| 7 | 8 |
) |
| 8 | 9 |
|
| 9 |
-func processAsyncHcsResult(err error, resultp *uint16, callbackNumber uintptr, expectedNotification hcsNotification, timeout *time.Duration) ([]ErrorEvent, error) {
|
|
| 10 |
- events := processHcsResult(resultp) |
|
| 10 |
+func processAsyncHcsResult(ctx context.Context, err error, resultJSON string, callbackNumber uintptr, expectedNotification hcsNotification, timeout *time.Duration) ([]ErrorEvent, error) {
|
|
| 11 |
+ events := processHcsResult(ctx, resultJSON) |
|
| 11 | 12 |
if IsPending(err) {
|
| 12 |
- return nil, waitForNotification(callbackNumber, expectedNotification, timeout) |
|
| 13 |
+ return nil, waitForNotification(ctx, callbackNumber, expectedNotification, timeout) |
|
| 13 | 14 |
} |
| 14 | 15 |
|
| 15 | 16 |
return events, err |
| 16 | 17 |
} |
| 17 | 18 |
|
| 18 |
-func waitForNotification(callbackNumber uintptr, expectedNotification hcsNotification, timeout *time.Duration) error {
|
|
| 19 |
+func waitForNotification(ctx context.Context, callbackNumber uintptr, expectedNotification hcsNotification, timeout *time.Duration) error {
|
|
| 19 | 20 |
callbackMapLock.RLock() |
| 20 | 21 |
if _, ok := callbackMap[callbackNumber]; !ok {
|
| 21 | 22 |
callbackMapLock.RUnlock() |
| 22 |
- logrus.Errorf("failed to waitForNotification: callbackNumber %d does not exist in callbackMap", callbackNumber)
|
|
| 23 |
+ log.G(ctx).WithField("callbackNumber", callbackNumber).Error("failed to waitForNotification: callbackNumber does not exist in callbackMap")
|
|
| 23 | 24 |
return ErrHandleClose |
| 24 | 25 |
} |
| 25 | 26 |
channels := callbackMap[callbackNumber].channels |
| ... | ... |
@@ -27,7 +28,7 @@ func waitForNotification(callbackNumber uintptr, expectedNotification hcsNotific |
| 27 | 27 |
|
| 28 | 28 |
expectedChannel := channels[expectedNotification] |
| 29 | 29 |
if expectedChannel == nil {
|
| 30 |
- logrus.Errorf("unknown notification type in waitForNotification %x", expectedNotification)
|
|
| 30 |
+ log.G(ctx).WithField("type", expectedNotification).Error("unknown notification type in waitForNotification")
|
|
| 31 | 31 |
return ErrInvalidNotificationType |
| 32 | 32 |
} |
| 33 | 33 |
|
| 34 | 34 |
deleted file mode 100644 |
| ... | ... |
@@ -1,41 +0,0 @@ |
| 1 |
-package hcs |
|
| 2 |
- |
|
| 3 |
-import ( |
|
| 4 |
- "context" |
|
| 5 |
- |
|
| 6 |
- "github.com/Microsoft/hcsshim/internal/logfields" |
|
| 7 |
- "github.com/Microsoft/hcsshim/internal/timeout" |
|
| 8 |
- "github.com/sirupsen/logrus" |
|
| 9 |
-) |
|
| 10 |
- |
|
| 11 |
-// syscallWatcher is used as a very simple goroutine around calls into |
|
| 12 |
-// the platform. In some cases, we have seen HCS APIs not returning due to |
|
| 13 |
-// various bugs, and the goroutine making the syscall ends up not returning, |
|
| 14 |
-// prior to its async callback. By spinning up a syscallWatcher, it allows |
|
| 15 |
-// us to at least log a warning if a syscall doesn't complete in a reasonable |
|
| 16 |
-// amount of time. |
|
| 17 |
-// |
|
| 18 |
-// Usage is: |
|
| 19 |
-// |
|
| 20 |
-// syscallWatcher(logContext, func() {
|
|
| 21 |
-// err = <syscall>(args...) |
|
| 22 |
-// }) |
|
| 23 |
-// |
|
| 24 |
- |
|
| 25 |
-func syscallWatcher(logContext logrus.Fields, syscallLambda func()) {
|
|
| 26 |
- ctx, cancel := context.WithTimeout(context.Background(), timeout.SyscallWatcher) |
|
| 27 |
- defer cancel() |
|
| 28 |
- go watchFunc(ctx, logContext) |
|
| 29 |
- syscallLambda() |
|
| 30 |
-} |
|
| 31 |
- |
|
| 32 |
-func watchFunc(ctx context.Context, logContext logrus.Fields) {
|
|
| 33 |
- select {
|
|
| 34 |
- case <-ctx.Done(): |
|
| 35 |
- if ctx.Err() != context.Canceled {
|
|
| 36 |
- logrus.WithFields(logContext). |
|
| 37 |
- WithField(logfields.Timeout, timeout.SyscallWatcher). |
|
| 38 |
- Warning("Syscall did not complete within operation timeout. This may indicate a platform issue. If it appears to be making no forward progress, obtain the stacks and see if there is a syscall stuck in the platform API for a significant length of time.")
|
|
| 39 |
- } |
|
| 40 |
- } |
|
| 41 |
-} |
| 42 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,533 +0,0 @@ |
| 1 |
-// Code generated mksyscall_windows.exe DO NOT EDIT |
|
| 2 |
- |
|
| 3 |
-package hcs |
|
| 4 |
- |
|
| 5 |
-import ( |
|
| 6 |
- "syscall" |
|
| 7 |
- "unsafe" |
|
| 8 |
- |
|
| 9 |
- "golang.org/x/sys/windows" |
|
| 10 |
-) |
|
| 11 |
- |
|
| 12 |
-var _ unsafe.Pointer |
|
| 13 |
- |
|
| 14 |
-// Do the interface allocations only once for common |
|
| 15 |
-// Errno values. |
|
| 16 |
-const ( |
|
| 17 |
- errnoERROR_IO_PENDING = 997 |
|
| 18 |
-) |
|
| 19 |
- |
|
| 20 |
-var ( |
|
| 21 |
- errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING) |
|
| 22 |
-) |
|
| 23 |
- |
|
| 24 |
-// errnoErr returns common boxed Errno values, to prevent |
|
| 25 |
-// allocations at runtime. |
|
| 26 |
-func errnoErr(e syscall.Errno) error {
|
|
| 27 |
- switch e {
|
|
| 28 |
- case 0: |
|
| 29 |
- return nil |
|
| 30 |
- case errnoERROR_IO_PENDING: |
|
| 31 |
- return errERROR_IO_PENDING |
|
| 32 |
- } |
|
| 33 |
- // TODO: add more here, after collecting data on the common |
|
| 34 |
- // error values see on Windows. (perhaps when running |
|
| 35 |
- // all.bat?) |
|
| 36 |
- return e |
|
| 37 |
-} |
|
| 38 |
- |
|
| 39 |
-var ( |
|
| 40 |
- modvmcompute = windows.NewLazySystemDLL("vmcompute.dll")
|
|
| 41 |
- |
|
| 42 |
- procHcsEnumerateComputeSystems = modvmcompute.NewProc("HcsEnumerateComputeSystems")
|
|
| 43 |
- procHcsCreateComputeSystem = modvmcompute.NewProc("HcsCreateComputeSystem")
|
|
| 44 |
- procHcsOpenComputeSystem = modvmcompute.NewProc("HcsOpenComputeSystem")
|
|
| 45 |
- procHcsCloseComputeSystem = modvmcompute.NewProc("HcsCloseComputeSystem")
|
|
| 46 |
- procHcsStartComputeSystem = modvmcompute.NewProc("HcsStartComputeSystem")
|
|
| 47 |
- procHcsShutdownComputeSystem = modvmcompute.NewProc("HcsShutdownComputeSystem")
|
|
| 48 |
- procHcsTerminateComputeSystem = modvmcompute.NewProc("HcsTerminateComputeSystem")
|
|
| 49 |
- procHcsPauseComputeSystem = modvmcompute.NewProc("HcsPauseComputeSystem")
|
|
| 50 |
- procHcsResumeComputeSystem = modvmcompute.NewProc("HcsResumeComputeSystem")
|
|
| 51 |
- procHcsGetComputeSystemProperties = modvmcompute.NewProc("HcsGetComputeSystemProperties")
|
|
| 52 |
- procHcsModifyComputeSystem = modvmcompute.NewProc("HcsModifyComputeSystem")
|
|
| 53 |
- procHcsRegisterComputeSystemCallback = modvmcompute.NewProc("HcsRegisterComputeSystemCallback")
|
|
| 54 |
- procHcsUnregisterComputeSystemCallback = modvmcompute.NewProc("HcsUnregisterComputeSystemCallback")
|
|
| 55 |
- procHcsCreateProcess = modvmcompute.NewProc("HcsCreateProcess")
|
|
| 56 |
- procHcsOpenProcess = modvmcompute.NewProc("HcsOpenProcess")
|
|
| 57 |
- procHcsCloseProcess = modvmcompute.NewProc("HcsCloseProcess")
|
|
| 58 |
- procHcsTerminateProcess = modvmcompute.NewProc("HcsTerminateProcess")
|
|
| 59 |
- procHcsSignalProcess = modvmcompute.NewProc("HcsSignalProcess")
|
|
| 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")
|
|
| 66 |
-) |
|
| 67 |
- |
|
| 68 |
-func hcsEnumerateComputeSystems(query string, computeSystems **uint16, result **uint16) (hr error) {
|
|
| 69 |
- var _p0 *uint16 |
|
| 70 |
- _p0, hr = syscall.UTF16PtrFromString(query) |
|
| 71 |
- if hr != nil {
|
|
| 72 |
- return |
|
| 73 |
- } |
|
| 74 |
- return _hcsEnumerateComputeSystems(_p0, computeSystems, result) |
|
| 75 |
-} |
|
| 76 |
- |
|
| 77 |
-func _hcsEnumerateComputeSystems(query *uint16, computeSystems **uint16, result **uint16) (hr error) {
|
|
| 78 |
- if hr = procHcsEnumerateComputeSystems.Find(); hr != nil {
|
|
| 79 |
- return |
|
| 80 |
- } |
|
| 81 |
- r0, _, _ := syscall.Syscall(procHcsEnumerateComputeSystems.Addr(), 3, uintptr(unsafe.Pointer(query)), uintptr(unsafe.Pointer(computeSystems)), uintptr(unsafe.Pointer(result))) |
|
| 82 |
- if int32(r0) < 0 {
|
|
| 83 |
- if r0&0x1fff0000 == 0x00070000 {
|
|
| 84 |
- r0 &= 0xffff |
|
| 85 |
- } |
|
| 86 |
- hr = syscall.Errno(r0) |
|
| 87 |
- } |
|
| 88 |
- return |
|
| 89 |
-} |
|
| 90 |
- |
|
| 91 |
-func hcsCreateComputeSystem(id string, configuration string, identity syscall.Handle, computeSystem *hcsSystem, result **uint16) (hr error) {
|
|
| 92 |
- var _p0 *uint16 |
|
| 93 |
- _p0, hr = syscall.UTF16PtrFromString(id) |
|
| 94 |
- if hr != nil {
|
|
| 95 |
- return |
|
| 96 |
- } |
|
| 97 |
- var _p1 *uint16 |
|
| 98 |
- _p1, hr = syscall.UTF16PtrFromString(configuration) |
|
| 99 |
- if hr != nil {
|
|
| 100 |
- return |
|
| 101 |
- } |
|
| 102 |
- return _hcsCreateComputeSystem(_p0, _p1, identity, computeSystem, result) |
|
| 103 |
-} |
|
| 104 |
- |
|
| 105 |
-func _hcsCreateComputeSystem(id *uint16, configuration *uint16, identity syscall.Handle, computeSystem *hcsSystem, result **uint16) (hr error) {
|
|
| 106 |
- if hr = procHcsCreateComputeSystem.Find(); hr != nil {
|
|
| 107 |
- return |
|
| 108 |
- } |
|
| 109 |
- r0, _, _ := syscall.Syscall6(procHcsCreateComputeSystem.Addr(), 5, uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(configuration)), uintptr(identity), uintptr(unsafe.Pointer(computeSystem)), uintptr(unsafe.Pointer(result)), 0) |
|
| 110 |
- if int32(r0) < 0 {
|
|
| 111 |
- if r0&0x1fff0000 == 0x00070000 {
|
|
| 112 |
- r0 &= 0xffff |
|
| 113 |
- } |
|
| 114 |
- hr = syscall.Errno(r0) |
|
| 115 |
- } |
|
| 116 |
- return |
|
| 117 |
-} |
|
| 118 |
- |
|
| 119 |
-func hcsOpenComputeSystem(id string, computeSystem *hcsSystem, result **uint16) (hr error) {
|
|
| 120 |
- var _p0 *uint16 |
|
| 121 |
- _p0, hr = syscall.UTF16PtrFromString(id) |
|
| 122 |
- if hr != nil {
|
|
| 123 |
- return |
|
| 124 |
- } |
|
| 125 |
- return _hcsOpenComputeSystem(_p0, computeSystem, result) |
|
| 126 |
-} |
|
| 127 |
- |
|
| 128 |
-func _hcsOpenComputeSystem(id *uint16, computeSystem *hcsSystem, result **uint16) (hr error) {
|
|
| 129 |
- if hr = procHcsOpenComputeSystem.Find(); hr != nil {
|
|
| 130 |
- return |
|
| 131 |
- } |
|
| 132 |
- r0, _, _ := syscall.Syscall(procHcsOpenComputeSystem.Addr(), 3, uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(computeSystem)), uintptr(unsafe.Pointer(result))) |
|
| 133 |
- if int32(r0) < 0 {
|
|
| 134 |
- if r0&0x1fff0000 == 0x00070000 {
|
|
| 135 |
- r0 &= 0xffff |
|
| 136 |
- } |
|
| 137 |
- hr = syscall.Errno(r0) |
|
| 138 |
- } |
|
| 139 |
- return |
|
| 140 |
-} |
|
| 141 |
- |
|
| 142 |
-func hcsCloseComputeSystem(computeSystem hcsSystem) (hr error) {
|
|
| 143 |
- if hr = procHcsCloseComputeSystem.Find(); hr != nil {
|
|
| 144 |
- return |
|
| 145 |
- } |
|
| 146 |
- r0, _, _ := syscall.Syscall(procHcsCloseComputeSystem.Addr(), 1, uintptr(computeSystem), 0, 0) |
|
| 147 |
- if int32(r0) < 0 {
|
|
| 148 |
- if r0&0x1fff0000 == 0x00070000 {
|
|
| 149 |
- r0 &= 0xffff |
|
| 150 |
- } |
|
| 151 |
- hr = syscall.Errno(r0) |
|
| 152 |
- } |
|
| 153 |
- return |
|
| 154 |
-} |
|
| 155 |
- |
|
| 156 |
-func hcsStartComputeSystem(computeSystem hcsSystem, options string, result **uint16) (hr error) {
|
|
| 157 |
- var _p0 *uint16 |
|
| 158 |
- _p0, hr = syscall.UTF16PtrFromString(options) |
|
| 159 |
- if hr != nil {
|
|
| 160 |
- return |
|
| 161 |
- } |
|
| 162 |
- return _hcsStartComputeSystem(computeSystem, _p0, result) |
|
| 163 |
-} |
|
| 164 |
- |
|
| 165 |
-func _hcsStartComputeSystem(computeSystem hcsSystem, options *uint16, result **uint16) (hr error) {
|
|
| 166 |
- if hr = procHcsStartComputeSystem.Find(); hr != nil {
|
|
| 167 |
- return |
|
| 168 |
- } |
|
| 169 |
- r0, _, _ := syscall.Syscall(procHcsStartComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result))) |
|
| 170 |
- if int32(r0) < 0 {
|
|
| 171 |
- if r0&0x1fff0000 == 0x00070000 {
|
|
| 172 |
- r0 &= 0xffff |
|
| 173 |
- } |
|
| 174 |
- hr = syscall.Errno(r0) |
|
| 175 |
- } |
|
| 176 |
- return |
|
| 177 |
-} |
|
| 178 |
- |
|
| 179 |
-func hcsShutdownComputeSystem(computeSystem hcsSystem, options string, result **uint16) (hr error) {
|
|
| 180 |
- var _p0 *uint16 |
|
| 181 |
- _p0, hr = syscall.UTF16PtrFromString(options) |
|
| 182 |
- if hr != nil {
|
|
| 183 |
- return |
|
| 184 |
- } |
|
| 185 |
- return _hcsShutdownComputeSystem(computeSystem, _p0, result) |
|
| 186 |
-} |
|
| 187 |
- |
|
| 188 |
-func _hcsShutdownComputeSystem(computeSystem hcsSystem, options *uint16, result **uint16) (hr error) {
|
|
| 189 |
- if hr = procHcsShutdownComputeSystem.Find(); hr != nil {
|
|
| 190 |
- return |
|
| 191 |
- } |
|
| 192 |
- r0, _, _ := syscall.Syscall(procHcsShutdownComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result))) |
|
| 193 |
- if int32(r0) < 0 {
|
|
| 194 |
- if r0&0x1fff0000 == 0x00070000 {
|
|
| 195 |
- r0 &= 0xffff |
|
| 196 |
- } |
|
| 197 |
- hr = syscall.Errno(r0) |
|
| 198 |
- } |
|
| 199 |
- return |
|
| 200 |
-} |
|
| 201 |
- |
|
| 202 |
-func hcsTerminateComputeSystem(computeSystem hcsSystem, options string, result **uint16) (hr error) {
|
|
| 203 |
- var _p0 *uint16 |
|
| 204 |
- _p0, hr = syscall.UTF16PtrFromString(options) |
|
| 205 |
- if hr != nil {
|
|
| 206 |
- return |
|
| 207 |
- } |
|
| 208 |
- return _hcsTerminateComputeSystem(computeSystem, _p0, result) |
|
| 209 |
-} |
|
| 210 |
- |
|
| 211 |
-func _hcsTerminateComputeSystem(computeSystem hcsSystem, options *uint16, result **uint16) (hr error) {
|
|
| 212 |
- if hr = procHcsTerminateComputeSystem.Find(); hr != nil {
|
|
| 213 |
- return |
|
| 214 |
- } |
|
| 215 |
- r0, _, _ := syscall.Syscall(procHcsTerminateComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result))) |
|
| 216 |
- if int32(r0) < 0 {
|
|
| 217 |
- if r0&0x1fff0000 == 0x00070000 {
|
|
| 218 |
- r0 &= 0xffff |
|
| 219 |
- } |
|
| 220 |
- hr = syscall.Errno(r0) |
|
| 221 |
- } |
|
| 222 |
- return |
|
| 223 |
-} |
|
| 224 |
- |
|
| 225 |
-func hcsPauseComputeSystem(computeSystem hcsSystem, options string, result **uint16) (hr error) {
|
|
| 226 |
- var _p0 *uint16 |
|
| 227 |
- _p0, hr = syscall.UTF16PtrFromString(options) |
|
| 228 |
- if hr != nil {
|
|
| 229 |
- return |
|
| 230 |
- } |
|
| 231 |
- return _hcsPauseComputeSystem(computeSystem, _p0, result) |
|
| 232 |
-} |
|
| 233 |
- |
|
| 234 |
-func _hcsPauseComputeSystem(computeSystem hcsSystem, options *uint16, result **uint16) (hr error) {
|
|
| 235 |
- if hr = procHcsPauseComputeSystem.Find(); hr != nil {
|
|
| 236 |
- return |
|
| 237 |
- } |
|
| 238 |
- r0, _, _ := syscall.Syscall(procHcsPauseComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result))) |
|
| 239 |
- if int32(r0) < 0 {
|
|
| 240 |
- if r0&0x1fff0000 == 0x00070000 {
|
|
| 241 |
- r0 &= 0xffff |
|
| 242 |
- } |
|
| 243 |
- hr = syscall.Errno(r0) |
|
| 244 |
- } |
|
| 245 |
- return |
|
| 246 |
-} |
|
| 247 |
- |
|
| 248 |
-func hcsResumeComputeSystem(computeSystem hcsSystem, options string, result **uint16) (hr error) {
|
|
| 249 |
- var _p0 *uint16 |
|
| 250 |
- _p0, hr = syscall.UTF16PtrFromString(options) |
|
| 251 |
- if hr != nil {
|
|
| 252 |
- return |
|
| 253 |
- } |
|
| 254 |
- return _hcsResumeComputeSystem(computeSystem, _p0, result) |
|
| 255 |
-} |
|
| 256 |
- |
|
| 257 |
-func _hcsResumeComputeSystem(computeSystem hcsSystem, options *uint16, result **uint16) (hr error) {
|
|
| 258 |
- if hr = procHcsResumeComputeSystem.Find(); hr != nil {
|
|
| 259 |
- return |
|
| 260 |
- } |
|
| 261 |
- r0, _, _ := syscall.Syscall(procHcsResumeComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result))) |
|
| 262 |
- if int32(r0) < 0 {
|
|
| 263 |
- if r0&0x1fff0000 == 0x00070000 {
|
|
| 264 |
- r0 &= 0xffff |
|
| 265 |
- } |
|
| 266 |
- hr = syscall.Errno(r0) |
|
| 267 |
- } |
|
| 268 |
- return |
|
| 269 |
-} |
|
| 270 |
- |
|
| 271 |
-func hcsGetComputeSystemProperties(computeSystem hcsSystem, propertyQuery string, properties **uint16, result **uint16) (hr error) {
|
|
| 272 |
- var _p0 *uint16 |
|
| 273 |
- _p0, hr = syscall.UTF16PtrFromString(propertyQuery) |
|
| 274 |
- if hr != nil {
|
|
| 275 |
- return |
|
| 276 |
- } |
|
| 277 |
- return _hcsGetComputeSystemProperties(computeSystem, _p0, properties, result) |
|
| 278 |
-} |
|
| 279 |
- |
|
| 280 |
-func _hcsGetComputeSystemProperties(computeSystem hcsSystem, propertyQuery *uint16, properties **uint16, result **uint16) (hr error) {
|
|
| 281 |
- if hr = procHcsGetComputeSystemProperties.Find(); hr != nil {
|
|
| 282 |
- return |
|
| 283 |
- } |
|
| 284 |
- r0, _, _ := syscall.Syscall6(procHcsGetComputeSystemProperties.Addr(), 4, uintptr(computeSystem), uintptr(unsafe.Pointer(propertyQuery)), uintptr(unsafe.Pointer(properties)), uintptr(unsafe.Pointer(result)), 0, 0) |
|
| 285 |
- if int32(r0) < 0 {
|
|
| 286 |
- if r0&0x1fff0000 == 0x00070000 {
|
|
| 287 |
- r0 &= 0xffff |
|
| 288 |
- } |
|
| 289 |
- hr = syscall.Errno(r0) |
|
| 290 |
- } |
|
| 291 |
- return |
|
| 292 |
-} |
|
| 293 |
- |
|
| 294 |
-func hcsModifyComputeSystem(computeSystem hcsSystem, configuration string, result **uint16) (hr error) {
|
|
| 295 |
- var _p0 *uint16 |
|
| 296 |
- _p0, hr = syscall.UTF16PtrFromString(configuration) |
|
| 297 |
- if hr != nil {
|
|
| 298 |
- return |
|
| 299 |
- } |
|
| 300 |
- return _hcsModifyComputeSystem(computeSystem, _p0, result) |
|
| 301 |
-} |
|
| 302 |
- |
|
| 303 |
-func _hcsModifyComputeSystem(computeSystem hcsSystem, configuration *uint16, result **uint16) (hr error) {
|
|
| 304 |
- if hr = procHcsModifyComputeSystem.Find(); hr != nil {
|
|
| 305 |
- return |
|
| 306 |
- } |
|
| 307 |
- r0, _, _ := syscall.Syscall(procHcsModifyComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(configuration)), uintptr(unsafe.Pointer(result))) |
|
| 308 |
- if int32(r0) < 0 {
|
|
| 309 |
- if r0&0x1fff0000 == 0x00070000 {
|
|
| 310 |
- r0 &= 0xffff |
|
| 311 |
- } |
|
| 312 |
- hr = syscall.Errno(r0) |
|
| 313 |
- } |
|
| 314 |
- return |
|
| 315 |
-} |
|
| 316 |
- |
|
| 317 |
-func hcsRegisterComputeSystemCallback(computeSystem hcsSystem, callback uintptr, context uintptr, callbackHandle *hcsCallback) (hr error) {
|
|
| 318 |
- if hr = procHcsRegisterComputeSystemCallback.Find(); hr != nil {
|
|
| 319 |
- return |
|
| 320 |
- } |
|
| 321 |
- r0, _, _ := syscall.Syscall6(procHcsRegisterComputeSystemCallback.Addr(), 4, uintptr(computeSystem), uintptr(callback), uintptr(context), uintptr(unsafe.Pointer(callbackHandle)), 0, 0) |
|
| 322 |
- if int32(r0) < 0 {
|
|
| 323 |
- if r0&0x1fff0000 == 0x00070000 {
|
|
| 324 |
- r0 &= 0xffff |
|
| 325 |
- } |
|
| 326 |
- hr = syscall.Errno(r0) |
|
| 327 |
- } |
|
| 328 |
- return |
|
| 329 |
-} |
|
| 330 |
- |
|
| 331 |
-func hcsUnregisterComputeSystemCallback(callbackHandle hcsCallback) (hr error) {
|
|
| 332 |
- if hr = procHcsUnregisterComputeSystemCallback.Find(); hr != nil {
|
|
| 333 |
- return |
|
| 334 |
- } |
|
| 335 |
- r0, _, _ := syscall.Syscall(procHcsUnregisterComputeSystemCallback.Addr(), 1, uintptr(callbackHandle), 0, 0) |
|
| 336 |
- if int32(r0) < 0 {
|
|
| 337 |
- if r0&0x1fff0000 == 0x00070000 {
|
|
| 338 |
- r0 &= 0xffff |
|
| 339 |
- } |
|
| 340 |
- hr = syscall.Errno(r0) |
|
| 341 |
- } |
|
| 342 |
- return |
|
| 343 |
-} |
|
| 344 |
- |
|
| 345 |
-func hcsCreateProcess(computeSystem hcsSystem, processParameters string, processInformation *hcsProcessInformation, process *hcsProcess, result **uint16) (hr error) {
|
|
| 346 |
- var _p0 *uint16 |
|
| 347 |
- _p0, hr = syscall.UTF16PtrFromString(processParameters) |
|
| 348 |
- if hr != nil {
|
|
| 349 |
- return |
|
| 350 |
- } |
|
| 351 |
- return _hcsCreateProcess(computeSystem, _p0, processInformation, process, result) |
|
| 352 |
-} |
|
| 353 |
- |
|
| 354 |
-func _hcsCreateProcess(computeSystem hcsSystem, processParameters *uint16, processInformation *hcsProcessInformation, process *hcsProcess, result **uint16) (hr error) {
|
|
| 355 |
- if hr = procHcsCreateProcess.Find(); hr != nil {
|
|
| 356 |
- return |
|
| 357 |
- } |
|
| 358 |
- r0, _, _ := syscall.Syscall6(procHcsCreateProcess.Addr(), 5, uintptr(computeSystem), uintptr(unsafe.Pointer(processParameters)), uintptr(unsafe.Pointer(processInformation)), uintptr(unsafe.Pointer(process)), uintptr(unsafe.Pointer(result)), 0) |
|
| 359 |
- if int32(r0) < 0 {
|
|
| 360 |
- if r0&0x1fff0000 == 0x00070000 {
|
|
| 361 |
- r0 &= 0xffff |
|
| 362 |
- } |
|
| 363 |
- hr = syscall.Errno(r0) |
|
| 364 |
- } |
|
| 365 |
- return |
|
| 366 |
-} |
|
| 367 |
- |
|
| 368 |
-func hcsOpenProcess(computeSystem hcsSystem, pid uint32, process *hcsProcess, result **uint16) (hr error) {
|
|
| 369 |
- if hr = procHcsOpenProcess.Find(); hr != nil {
|
|
| 370 |
- return |
|
| 371 |
- } |
|
| 372 |
- r0, _, _ := syscall.Syscall6(procHcsOpenProcess.Addr(), 4, uintptr(computeSystem), uintptr(pid), uintptr(unsafe.Pointer(process)), uintptr(unsafe.Pointer(result)), 0, 0) |
|
| 373 |
- if int32(r0) < 0 {
|
|
| 374 |
- if r0&0x1fff0000 == 0x00070000 {
|
|
| 375 |
- r0 &= 0xffff |
|
| 376 |
- } |
|
| 377 |
- hr = syscall.Errno(r0) |
|
| 378 |
- } |
|
| 379 |
- return |
|
| 380 |
-} |
|
| 381 |
- |
|
| 382 |
-func hcsCloseProcess(process hcsProcess) (hr error) {
|
|
| 383 |
- if hr = procHcsCloseProcess.Find(); hr != nil {
|
|
| 384 |
- return |
|
| 385 |
- } |
|
| 386 |
- r0, _, _ := syscall.Syscall(procHcsCloseProcess.Addr(), 1, uintptr(process), 0, 0) |
|
| 387 |
- if int32(r0) < 0 {
|
|
| 388 |
- if r0&0x1fff0000 == 0x00070000 {
|
|
| 389 |
- r0 &= 0xffff |
|
| 390 |
- } |
|
| 391 |
- hr = syscall.Errno(r0) |
|
| 392 |
- } |
|
| 393 |
- return |
|
| 394 |
-} |
|
| 395 |
- |
|
| 396 |
-func hcsTerminateProcess(process hcsProcess, result **uint16) (hr error) {
|
|
| 397 |
- if hr = procHcsTerminateProcess.Find(); hr != nil {
|
|
| 398 |
- return |
|
| 399 |
- } |
|
| 400 |
- r0, _, _ := syscall.Syscall(procHcsTerminateProcess.Addr(), 2, uintptr(process), uintptr(unsafe.Pointer(result)), 0) |
|
| 401 |
- if int32(r0) < 0 {
|
|
| 402 |
- if r0&0x1fff0000 == 0x00070000 {
|
|
| 403 |
- r0 &= 0xffff |
|
| 404 |
- } |
|
| 405 |
- hr = syscall.Errno(r0) |
|
| 406 |
- } |
|
| 407 |
- return |
|
| 408 |
-} |
|
| 409 |
- |
|
| 410 |
-func hcsSignalProcess(process hcsProcess, options string, result **uint16) (hr error) {
|
|
| 411 |
- var _p0 *uint16 |
|
| 412 |
- _p0, hr = syscall.UTF16PtrFromString(options) |
|
| 413 |
- if hr != nil {
|
|
| 414 |
- return |
|
| 415 |
- } |
|
| 416 |
- return _hcsSignalProcess(process, _p0, result) |
|
| 417 |
-} |
|
| 418 |
- |
|
| 419 |
-func _hcsSignalProcess(process hcsProcess, options *uint16, result **uint16) (hr error) {
|
|
| 420 |
- if hr = procHcsSignalProcess.Find(); hr != nil {
|
|
| 421 |
- return |
|
| 422 |
- } |
|
| 423 |
- r0, _, _ := syscall.Syscall(procHcsSignalProcess.Addr(), 3, uintptr(process), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result))) |
|
| 424 |
- if int32(r0) < 0 {
|
|
| 425 |
- if r0&0x1fff0000 == 0x00070000 {
|
|
| 426 |
- r0 &= 0xffff |
|
| 427 |
- } |
|
| 428 |
- hr = syscall.Errno(r0) |
|
| 429 |
- } |
|
| 430 |
- return |
|
| 431 |
-} |
|
| 432 |
- |
|
| 433 |
-func hcsGetProcessInfo(process hcsProcess, processInformation *hcsProcessInformation, result **uint16) (hr error) {
|
|
| 434 |
- if hr = procHcsGetProcessInfo.Find(); hr != nil {
|
|
| 435 |
- return |
|
| 436 |
- } |
|
| 437 |
- r0, _, _ := syscall.Syscall(procHcsGetProcessInfo.Addr(), 3, uintptr(process), uintptr(unsafe.Pointer(processInformation)), uintptr(unsafe.Pointer(result))) |
|
| 438 |
- if int32(r0) < 0 {
|
|
| 439 |
- if r0&0x1fff0000 == 0x00070000 {
|
|
| 440 |
- r0 &= 0xffff |
|
| 441 |
- } |
|
| 442 |
- hr = syscall.Errno(r0) |
|
| 443 |
- } |
|
| 444 |
- return |
|
| 445 |
-} |
|
| 446 |
- |
|
| 447 |
-func hcsGetProcessProperties(process hcsProcess, processProperties **uint16, result **uint16) (hr error) {
|
|
| 448 |
- if hr = procHcsGetProcessProperties.Find(); hr != nil {
|
|
| 449 |
- return |
|
| 450 |
- } |
|
| 451 |
- r0, _, _ := syscall.Syscall(procHcsGetProcessProperties.Addr(), 3, uintptr(process), uintptr(unsafe.Pointer(processProperties)), uintptr(unsafe.Pointer(result))) |
|
| 452 |
- if int32(r0) < 0 {
|
|
| 453 |
- if r0&0x1fff0000 == 0x00070000 {
|
|
| 454 |
- r0 &= 0xffff |
|
| 455 |
- } |
|
| 456 |
- hr = syscall.Errno(r0) |
|
| 457 |
- } |
|
| 458 |
- return |
|
| 459 |
-} |
|
| 460 |
- |
|
| 461 |
-func hcsModifyProcess(process hcsProcess, settings string, result **uint16) (hr error) {
|
|
| 462 |
- var _p0 *uint16 |
|
| 463 |
- _p0, hr = syscall.UTF16PtrFromString(settings) |
|
| 464 |
- if hr != nil {
|
|
| 465 |
- return |
|
| 466 |
- } |
|
| 467 |
- return _hcsModifyProcess(process, _p0, result) |
|
| 468 |
-} |
|
| 469 |
- |
|
| 470 |
-func _hcsModifyProcess(process hcsProcess, settings *uint16, result **uint16) (hr error) {
|
|
| 471 |
- if hr = procHcsModifyProcess.Find(); hr != nil {
|
|
| 472 |
- return |
|
| 473 |
- } |
|
| 474 |
- r0, _, _ := syscall.Syscall(procHcsModifyProcess.Addr(), 3, uintptr(process), uintptr(unsafe.Pointer(settings)), uintptr(unsafe.Pointer(result))) |
|
| 475 |
- if int32(r0) < 0 {
|
|
| 476 |
- if r0&0x1fff0000 == 0x00070000 {
|
|
| 477 |
- r0 &= 0xffff |
|
| 478 |
- } |
|
| 479 |
- hr = syscall.Errno(r0) |
|
| 480 |
- } |
|
| 481 |
- return |
|
| 482 |
-} |
|
| 483 |
- |
|
| 484 |
-func hcsGetServiceProperties(propertyQuery string, properties **uint16, result **uint16) (hr error) {
|
|
| 485 |
- var _p0 *uint16 |
|
| 486 |
- _p0, hr = syscall.UTF16PtrFromString(propertyQuery) |
|
| 487 |
- if hr != nil {
|
|
| 488 |
- return |
|
| 489 |
- } |
|
| 490 |
- return _hcsGetServiceProperties(_p0, properties, result) |
|
| 491 |
-} |
|
| 492 |
- |
|
| 493 |
-func _hcsGetServiceProperties(propertyQuery *uint16, properties **uint16, result **uint16) (hr error) {
|
|
| 494 |
- if hr = procHcsGetServiceProperties.Find(); hr != nil {
|
|
| 495 |
- return |
|
| 496 |
- } |
|
| 497 |
- r0, _, _ := syscall.Syscall(procHcsGetServiceProperties.Addr(), 3, uintptr(unsafe.Pointer(propertyQuery)), uintptr(unsafe.Pointer(properties)), uintptr(unsafe.Pointer(result))) |
|
| 498 |
- if int32(r0) < 0 {
|
|
| 499 |
- if r0&0x1fff0000 == 0x00070000 {
|
|
| 500 |
- r0 &= 0xffff |
|
| 501 |
- } |
|
| 502 |
- hr = syscall.Errno(r0) |
|
| 503 |
- } |
|
| 504 |
- return |
|
| 505 |
-} |
|
| 506 |
- |
|
| 507 |
-func hcsRegisterProcessCallback(process hcsProcess, callback uintptr, context uintptr, callbackHandle *hcsCallback) (hr error) {
|
|
| 508 |
- if hr = procHcsRegisterProcessCallback.Find(); hr != nil {
|
|
| 509 |
- return |
|
| 510 |
- } |
|
| 511 |
- r0, _, _ := syscall.Syscall6(procHcsRegisterProcessCallback.Addr(), 4, uintptr(process), uintptr(callback), uintptr(context), uintptr(unsafe.Pointer(callbackHandle)), 0, 0) |
|
| 512 |
- if int32(r0) < 0 {
|
|
| 513 |
- if r0&0x1fff0000 == 0x00070000 {
|
|
| 514 |
- r0 &= 0xffff |
|
| 515 |
- } |
|
| 516 |
- hr = syscall.Errno(r0) |
|
| 517 |
- } |
|
| 518 |
- return |
|
| 519 |
-} |
|
| 520 |
- |
|
| 521 |
-func hcsUnregisterProcessCallback(callbackHandle hcsCallback) (hr error) {
|
|
| 522 |
- if hr = procHcsUnregisterProcessCallback.Find(); hr != nil {
|
|
| 523 |
- return |
|
| 524 |
- } |
|
| 525 |
- r0, _, _ := syscall.Syscall(procHcsUnregisterProcessCallback.Addr(), 1, uintptr(callbackHandle), 0, 0) |
|
| 526 |
- if int32(r0) < 0 {
|
|
| 527 |
- if r0&0x1fff0000 == 0x00070000 {
|
|
| 528 |
- r0 &= 0xffff |
|
| 529 |
- } |
|
| 530 |
- hr = syscall.Errno(r0) |
|
| 531 |
- } |
|
| 532 |
- return |
|
| 533 |
-} |
| ... | ... |
@@ -3,6 +3,7 @@ package hns |
| 3 | 3 |
import ( |
| 4 | 4 |
"encoding/json" |
| 5 | 5 |
"net" |
| 6 |
+ "strings" |
|
| 6 | 7 |
|
| 7 | 8 |
"github.com/sirupsen/logrus" |
| 8 | 9 |
) |
| ... | ... |
@@ -94,6 +95,27 @@ func GetHNSEndpointByName(endpointName string) (*HNSEndpoint, error) {
|
| 94 | 94 |
return nil, EndpointNotFoundError{EndpointName: endpointName}
|
| 95 | 95 |
} |
| 96 | 96 |
|
| 97 |
+type endpointAttachInfo struct {
|
|
| 98 |
+ SharedContainers json.RawMessage `json:",omitempty"` |
|
| 99 |
+} |
|
| 100 |
+ |
|
| 101 |
+func (endpoint *HNSEndpoint) IsAttached(vID string) (bool, error) {
|
|
| 102 |
+ attachInfo := endpointAttachInfo{}
|
|
| 103 |
+ err := hnsCall("GET", "/endpoints/"+endpoint.Id, "", &attachInfo)
|
|
| 104 |
+ |
|
| 105 |
+ // Return false allows us to just return the err |
|
| 106 |
+ if err != nil {
|
|
| 107 |
+ return false, err |
|
| 108 |
+ } |
|
| 109 |
+ |
|
| 110 |
+ if strings.Contains(strings.ToLower(string(attachInfo.SharedContainers)), strings.ToLower(vID)) {
|
|
| 111 |
+ return true, nil |
|
| 112 |
+ } |
|
| 113 |
+ |
|
| 114 |
+ return false, nil |
|
| 115 |
+ |
|
| 116 |
+} |
|
| 117 |
+ |
|
| 97 | 118 |
// Create Endpoint by sending EndpointRequest to HNS. TODO: Create a separate HNS interface to place all these methods |
| 98 | 119 |
func (endpoint *HNSEndpoint) Create() (*HNSEndpoint, error) {
|
| 99 | 120 |
operation := "Create" |
| ... | ... |
@@ -9,23 +9,30 @@ import ( |
| 9 | 9 |
"github.com/sirupsen/logrus" |
| 10 | 10 |
) |
| 11 | 11 |
|
| 12 |
-func hnsCall(method, path, request string, returnResponse interface{}) error {
|
|
| 12 |
+func hnsCallRawResponse(method, path, request string) (*hnsResponse, error) {
|
|
| 13 | 13 |
var responseBuffer *uint16 |
| 14 | 14 |
logrus.Debugf("[%s]=>[%s] Request : %s", method, path, request)
|
| 15 | 15 |
|
| 16 | 16 |
err := _hnsCall(method, path, request, &responseBuffer) |
| 17 | 17 |
if err != nil {
|
| 18 |
- return hcserror.New(err, "hnsCall ", "") |
|
| 18 |
+ return nil, hcserror.New(err, "hnsCall ", "") |
|
| 19 | 19 |
} |
| 20 | 20 |
response := interop.ConvertAndFreeCoTaskMemString(responseBuffer) |
| 21 | 21 |
|
| 22 | 22 |
hnsresponse := &hnsResponse{}
|
| 23 | 23 |
if err = json.Unmarshal([]byte(response), &hnsresponse); err != nil {
|
| 24 |
- return err |
|
| 24 |
+ return nil, err |
|
| 25 | 25 |
} |
| 26 |
+ return hnsresponse, nil |
|
| 27 |
+} |
|
| 26 | 28 |
|
| 29 |
+func hnsCall(method, path, request string, returnResponse interface{}) error {
|
|
| 30 |
+ hnsresponse, err := hnsCallRawResponse(method, path, request) |
|
| 31 |
+ if err != nil {
|
|
| 32 |
+ return fmt.Errorf("failed during hnsCallRawResponse: %v", err)
|
|
| 33 |
+ } |
|
| 27 | 34 |
if !hnsresponse.Success {
|
| 28 |
- return fmt.Errorf("HNS failed with error : %s", hnsresponse.Error)
|
|
| 35 |
+ return fmt.Errorf("hns failed with error : %s", hnsresponse.Error)
|
|
| 29 | 36 |
} |
| 30 | 37 |
|
| 31 | 38 |
if len(hnsresponse.Output) == 0 {
|
| ... | ... |
@@ -55,8 +55,9 @@ type PaPolicy struct {
|
| 55 | 55 |
|
| 56 | 56 |
type OutboundNatPolicy struct {
|
| 57 | 57 |
Policy |
| 58 |
- VIP string `json:"VIP,omitempty"` |
|
| 59 |
- Exceptions []string `json:"ExceptionList,omitempty"` |
|
| 58 |
+ VIP string `json:"VIP,omitempty"` |
|
| 59 |
+ Exceptions []string `json:"ExceptionList,omitempty"` |
|
| 60 |
+ Destinations []string `json:",omitempty"` |
|
| 60 | 61 |
} |
| 61 | 62 |
|
| 62 | 63 |
type ActionType string |
| ... | ... |
@@ -15,10 +15,6 @@ func ConvertAndFreeCoTaskMemString(buffer *uint16) string {
|
| 15 | 15 |
return str |
| 16 | 16 |
} |
| 17 | 17 |
|
| 18 |
-func ConvertAndFreeCoTaskMemBytes(buffer *uint16) []byte {
|
|
| 19 |
- return []byte(ConvertAndFreeCoTaskMemString(buffer)) |
|
| 20 |
-} |
|
| 21 |
- |
|
| 22 | 18 |
func Win32FromHresult(hr uintptr) syscall.Errno {
|
| 23 | 19 |
if hr&0x1fff0000 == 0x00070000 {
|
| 24 | 20 |
return syscall.Errno(hr & 0xffff) |
| 25 | 21 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,23 @@ |
| 0 |
+package log |
|
| 1 |
+ |
|
| 2 |
+import ( |
|
| 3 |
+ "context" |
|
| 4 |
+ |
|
| 5 |
+ "github.com/sirupsen/logrus" |
|
| 6 |
+ "go.opencensus.io/trace" |
|
| 7 |
+) |
|
| 8 |
+ |
|
| 9 |
+// G returns a `logrus.Entry` with the `TraceID, SpanID` from `ctx` if `ctx` |
|
| 10 |
+// contains an OpenCensus `trace.Span`. |
|
| 11 |
+func G(ctx context.Context) *logrus.Entry {
|
|
| 12 |
+ span := trace.FromContext(ctx) |
|
| 13 |
+ if span != nil {
|
|
| 14 |
+ sctx := span.SpanContext() |
|
| 15 |
+ return logrus.WithFields(logrus.Fields{
|
|
| 16 |
+ "traceID": sctx.TraceID.String(), |
|
| 17 |
+ "spanID": sctx.SpanID.String(), |
|
| 18 |
+ // "parentSpanID": TODO: JTERRY75 - Try to convince OC to export this? |
|
| 19 |
+ }) |
|
| 20 |
+ } |
|
| 21 |
+ return logrus.NewEntry(logrus.StandardLogger()) |
|
| 22 |
+} |
| 0 | 23 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,43 @@ |
| 0 |
+package oc |
|
| 1 |
+ |
|
| 2 |
+import ( |
|
| 3 |
+ "github.com/sirupsen/logrus" |
|
| 4 |
+ "go.opencensus.io/trace" |
|
| 5 |
+) |
|
| 6 |
+ |
|
| 7 |
+var _ = (trace.Exporter)(&LogrusExporter{})
|
|
| 8 |
+ |
|
| 9 |
+// LogrusExporter is an OpenCensus `trace.Exporter` that exports |
|
| 10 |
+// `trace.SpanData` to logrus output. |
|
| 11 |
+type LogrusExporter struct {
|
|
| 12 |
+} |
|
| 13 |
+ |
|
| 14 |
+// ExportSpan exports `s` based on the the following rules: |
|
| 15 |
+// |
|
| 16 |
+// 1. All output will contain `s.Attributes`, `s.TraceID`, `s.SpanID`, |
|
| 17 |
+// `s.ParentSpanID` for correlation |
|
| 18 |
+// |
|
| 19 |
+// 2. Any calls to .Annotate will not be supported. |
|
| 20 |
+// |
|
| 21 |
+// 3. The span itself will be written at `logrus.InfoLevel` unless |
|
| 22 |
+// `s.Status.Code != 0` in which case it will be written at `logrus.ErrorLevel` |
|
| 23 |
+// providing `s.Status.Message` as the error value. |
|
| 24 |
+func (le *LogrusExporter) ExportSpan(s *trace.SpanData) {
|
|
| 25 |
+ // Combine all span annotations with traceID, spanID, parentSpanID |
|
| 26 |
+ baseEntry := logrus.WithFields(logrus.Fields(s.Attributes)) |
|
| 27 |
+ baseEntry.Data["traceID"] = s.TraceID.String() |
|
| 28 |
+ baseEntry.Data["spanID"] = s.SpanID.String() |
|
| 29 |
+ baseEntry.Data["parentSpanID"] = s.ParentSpanID.String() |
|
| 30 |
+ baseEntry.Data["startTime"] = s.StartTime |
|
| 31 |
+ baseEntry.Data["endTime"] = s.EndTime |
|
| 32 |
+ baseEntry.Data["duration"] = s.EndTime.Sub(s.StartTime).String() |
|
| 33 |
+ baseEntry.Data["name"] = s.Name |
|
| 34 |
+ baseEntry.Time = s.StartTime |
|
| 35 |
+ |
|
| 36 |
+ level := logrus.InfoLevel |
|
| 37 |
+ if s.Status.Code != 0 {
|
|
| 38 |
+ level = logrus.ErrorLevel |
|
| 39 |
+ baseEntry.Data[logrus.ErrorKey] = s.Status.Message |
|
| 40 |
+ } |
|
| 41 |
+ baseEntry.Log(level, "Span") |
|
| 42 |
+} |
| 0 | 43 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,17 @@ |
| 0 |
+package oc |
|
| 1 |
+ |
|
| 2 |
+import ( |
|
| 3 |
+ "go.opencensus.io/trace" |
|
| 4 |
+) |
|
| 5 |
+ |
|
| 6 |
+// SetSpanStatus sets `span.SetStatus` to the proper status depending on `err`. If |
|
| 7 |
+// `err` is `nil` assumes `trace.StatusCodeOk`. |
|
| 8 |
+func SetSpanStatus(span *trace.Span, err error) {
|
|
| 9 |
+ status := trace.Status{}
|
|
| 10 |
+ if err != nil {
|
|
| 11 |
+ // TODO: JTERRY75 - Handle errors in a non-generic way |
|
| 12 |
+ status.Code = trace.StatusCodeUnknown |
|
| 13 |
+ status.Message = err.Error() |
|
| 14 |
+ } |
|
| 15 |
+ span.SetStatus(status) |
|
| 16 |
+} |
| ... | ... |
@@ -4,7 +4,8 @@ import ( |
| 4 | 4 |
"encoding/json" |
| 5 | 5 |
"time" |
| 6 | 6 |
|
| 7 |
- "github.com/Microsoft/hcsshim/internal/schema2" |
|
| 7 |
+ "github.com/Microsoft/go-winio/pkg/guid" |
|
| 8 |
+ hcsschema "github.com/Microsoft/hcsshim/internal/schema2" |
|
| 8 | 9 |
) |
| 9 | 10 |
|
| 10 | 11 |
// ProcessConfig is used as both the input of Container.CreateProcess |
| ... | ... |
@@ -62,7 +63,7 @@ type MappedVirtualDisk struct {
|
| 62 | 62 |
CreateInUtilityVM bool `json:",omitempty"` |
| 63 | 63 |
ReadOnly bool `json:",omitempty"` |
| 64 | 64 |
Cache string `json:",omitempty"` // "" (Unspecified); "Disabled"; "Enabled"; "Private"; "PrivateAllowSharing" |
| 65 |
- AttachOnly bool `json:",omitempty:` |
|
| 65 |
+ AttachOnly bool `json:",omitempty"` |
|
| 66 | 66 |
} |
| 67 | 67 |
|
| 68 | 68 |
// AssignedDevice represents a device that has been directly assigned to a container |
| ... | ... |
@@ -133,9 +134,10 @@ type ContainerProperties struct {
|
| 133 | 133 |
State string |
| 134 | 134 |
Name string |
| 135 | 135 |
SystemType string |
| 136 |
+ RuntimeOSType string `json:"RuntimeOsType,omitempty"` |
|
| 136 | 137 |
Owner string |
| 137 | 138 |
SiloGUID string `json:"SiloGuid,omitempty"` |
| 138 |
- RuntimeID string `json:"RuntimeId,omitempty"` |
|
| 139 |
+ RuntimeID guid.GUID `json:"RuntimeId,omitempty"` |
|
| 139 | 140 |
IsRuntimeTemplate bool `json:",omitempty"` |
| 140 | 141 |
RuntimeImagePath string `json:",omitempty"` |
| 141 | 142 |
Stopped bool `json:",omitempty"` |
| ... | ... |
@@ -214,6 +216,7 @@ type MappedVirtualDiskController struct {
|
| 214 | 214 |
type GuestDefinedCapabilities struct {
|
| 215 | 215 |
NamespaceAddRequestSupported bool `json:",omitempty"` |
| 216 | 216 |
SignalProcessSupported bool `json:",omitempty"` |
| 217 |
+ DumpStacksSupported bool `json:",omitempty"` |
|
| 217 | 218 |
} |
| 218 | 219 |
|
| 219 | 220 |
// GuestConnectionInfo is the structure of an iterm return by a GuestConnection call on a utility VM |
| ... | ... |
@@ -11,7 +11,6 @@ package hcsschema |
| 11 | 11 |
|
| 12 | 12 |
// ComPort specifies the named pipe that will be used for the port, with empty string indicating a disconnected port. |
| 13 | 13 |
type ComPort struct {
|
| 14 |
- |
|
| 15 | 14 |
NamedPipe string `json:"NamedPipe,omitempty"` |
| 16 | 15 |
|
| 17 | 16 |
OptimizeForDebugger bool `json:"OptimizeForDebugger,omitempty"` |
| ... | ... |
@@ -10,14 +10,13 @@ |
| 10 | 10 |
package hcsschema |
| 11 | 11 |
|
| 12 | 12 |
type ComputeSystem struct {
|
| 13 |
- |
|
| 14 | 13 |
Owner string `json:"Owner,omitempty"` |
| 15 | 14 |
|
| 16 | 15 |
SchemaVersion *Version `json:"SchemaVersion,omitempty"` |
| 17 | 16 |
|
| 18 | 17 |
HostingSystemId string `json:"HostingSystemId,omitempty"` |
| 19 | 18 |
|
| 20 |
- HostedSystem *HostedSystem `json:"HostedSystem,omitempty"` |
|
| 19 |
+ HostedSystem interface{} `json:"HostedSystem,omitempty"`
|
|
| 21 | 20 |
|
| 22 | 21 |
Container *Container `json:"Container,omitempty"` |
| 23 | 22 |
|
| ... | ... |
@@ -25,37 +25,37 @@ func (c contextKey) String() string {
|
| 25 | 25 |
|
| 26 | 26 |
var ( |
| 27 | 27 |
// ContextOAuth2 takes a oauth2.TokenSource as authentication for the request. |
| 28 |
- ContextOAuth2 = contextKey("token")
|
|
| 28 |
+ ContextOAuth2 = contextKey("token")
|
|
| 29 | 29 |
|
| 30 | 30 |
// ContextBasicAuth takes BasicAuth as authentication for the request. |
| 31 |
- ContextBasicAuth = contextKey("basic")
|
|
| 31 |
+ ContextBasicAuth = contextKey("basic")
|
|
| 32 | 32 |
|
| 33 | 33 |
// ContextAccessToken takes a string oauth2 access token as authentication for the request. |
| 34 |
- ContextAccessToken = contextKey("accesstoken")
|
|
| 34 |
+ ContextAccessToken = contextKey("accesstoken")
|
|
| 35 | 35 |
|
| 36 | 36 |
// ContextAPIKey takes an APIKey as authentication for the request |
| 37 |
- ContextAPIKey = contextKey("apikey")
|
|
| 37 |
+ ContextAPIKey = contextKey("apikey")
|
|
| 38 | 38 |
) |
| 39 | 39 |
|
| 40 |
-// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth |
|
| 40 |
+// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth |
|
| 41 | 41 |
type BasicAuth struct {
|
| 42 |
- UserName string `json:"userName,omitempty"` |
|
| 43 |
- Password string `json:"password,omitempty"` |
|
| 42 |
+ UserName string `json:"userName,omitempty"` |
|
| 43 |
+ Password string `json:"password,omitempty"` |
|
| 44 | 44 |
} |
| 45 | 45 |
|
| 46 | 46 |
// APIKey provides API key based authentication to a request passed via context using ContextAPIKey |
| 47 | 47 |
type APIKey struct {
|
| 48 |
- Key string |
|
| 49 |
- Prefix string |
|
| 48 |
+ Key string |
|
| 49 |
+ Prefix string |
|
| 50 | 50 |
} |
| 51 | 51 |
|
| 52 | 52 |
type Configuration struct {
|
| 53 |
- BasePath string `json:"basePath,omitempty"` |
|
| 54 |
- Host string `json:"host,omitempty"` |
|
| 55 |
- Scheme string `json:"scheme,omitempty"` |
|
| 56 |
- DefaultHeader map[string]string `json:"defaultHeader,omitempty"` |
|
| 57 |
- UserAgent string `json:"userAgent,omitempty"` |
|
| 58 |
- HTTPClient *http.Client |
|
| 53 |
+ BasePath string `json:"basePath,omitempty"` |
|
| 54 |
+ Host string `json:"host,omitempty"` |
|
| 55 |
+ Scheme string `json:"scheme,omitempty"` |
|
| 56 |
+ DefaultHeader map[string]string `json:"defaultHeader,omitempty"` |
|
| 57 |
+ UserAgent string `json:"userAgent,omitempty"` |
|
| 58 |
+ HTTPClient *http.Client |
|
| 59 | 59 |
} |
| 60 | 60 |
|
| 61 | 61 |
func NewConfiguration() *Configuration {
|
| ... | ... |
@@ -69,4 +69,4 @@ func NewConfiguration() *Configuration {
|
| 69 | 69 |
|
| 70 | 70 |
func (c *Configuration) AddDefaultHeader(key string, value string) {
|
| 71 | 71 |
c.DefaultHeader[key] = value |
| 72 |
-} |
|
| 73 | 72 |
\ No newline at end of file |
| 73 |
+} |
| ... | ... |
@@ -22,4 +22,9 @@ type Memory2 struct {
|
| 22 | 22 |
|
| 23 | 23 |
// EnableDeferredCommit is private in the schema. If regenerated need to add back. |
| 24 | 24 |
EnableDeferredCommit bool `json:"EnableDeferredCommit,omitempty"` |
| 25 |
+ |
|
| 26 |
+ // EnableColdDiscardHint if enabled, then the memory cold discard hint feature is exposed |
|
| 27 |
+ // to the VM, allowing it to trim non-zeroed pages from the working set (if supported by |
|
| 28 |
+ // the guest operating system). |
|
| 29 |
+ EnableColdDiscardHint bool `json:"EnableColdDiscardHint,omitempty"` |
|
| 25 | 30 |
} |
| ... | ... |
@@ -10,8 +10,7 @@ |
| 10 | 10 |
package hcsschema |
| 11 | 11 |
|
| 12 | 12 |
type MemoryInformationForVm struct {
|
| 13 |
- |
|
| 14 |
- VirtualNodeCount int32 `json:"VirtualNodeCount,omitempty"` |
|
| 13 |
+ VirtualNodeCount uint32 `json:"VirtualNodeCount,omitempty"` |
|
| 15 | 14 |
|
| 16 | 15 |
VirtualMachineMemory *VmMemory `json:"VirtualMachineMemory,omitempty"` |
| 17 | 16 |
|
| ... | ... |
@@ -11,10 +11,9 @@ package hcsschema |
| 11 | 11 |
|
| 12 | 12 |
// Memory runtime statistics |
| 13 | 13 |
type MemoryStats struct {
|
| 14 |
+ MemoryUsageCommitBytes uint64 `json:"MemoryUsageCommitBytes,omitempty"` |
|
| 14 | 15 |
|
| 15 |
- MemoryUsageCommitBytes int32 `json:"MemoryUsageCommitBytes,omitempty"` |
|
| 16 |
+ MemoryUsageCommitPeakBytes uint64 `json:"MemoryUsageCommitPeakBytes,omitempty"` |
|
| 16 | 17 |
|
| 17 |
- MemoryUsageCommitPeakBytes int32 `json:"MemoryUsageCommitPeakBytes,omitempty"` |
|
| 18 |
- |
|
| 19 |
- MemoryUsagePrivateWorkingSetBytes int32 `json:"MemoryUsagePrivateWorkingSetBytes,omitempty"` |
|
| 18 |
+ MemoryUsagePrivateWorkingSetBytes uint64 `json:"MemoryUsagePrivateWorkingSetBytes,omitempty"` |
|
| 20 | 19 |
} |
| ... | ... |
@@ -11,10 +11,9 @@ package hcsschema |
| 11 | 11 |
|
| 12 | 12 |
// CPU runtime statistics |
| 13 | 13 |
type ProcessorStats struct {
|
| 14 |
+ TotalRuntime100ns uint64 `json:"TotalRuntime100ns,omitempty"` |
|
| 14 | 15 |
|
| 15 |
- TotalRuntime100ns int32 `json:"TotalRuntime100ns,omitempty"` |
|
| 16 |
+ RuntimeUser100ns uint64 `json:"RuntimeUser100ns,omitempty"` |
|
| 16 | 17 |
|
| 17 |
- RuntimeUser100ns int32 `json:"RuntimeUser100ns,omitempty"` |
|
| 18 |
- |
|
| 19 |
- RuntimeKernel100ns int32 `json:"RuntimeKernel100ns,omitempty"` |
|
| 18 |
+ RuntimeKernel100ns uint64 `json:"RuntimeKernel100ns,omitempty"` |
|
| 20 | 19 |
} |
| ... | ... |
@@ -9,8 +9,11 @@ |
| 9 | 9 |
|
| 10 | 10 |
package hcsschema |
| 11 | 11 |
|
| 12 |
-type Properties struct {
|
|
| 12 |
+import ( |
|
| 13 |
+ v1 "github.com/containerd/cgroups/stats/v1" |
|
| 14 |
+) |
|
| 13 | 15 |
|
| 16 |
+type Properties struct {
|
|
| 14 | 17 |
Id string `json:"Id,omitempty"` |
| 15 | 18 |
|
| 16 | 19 |
SystemType string `json:"SystemType,omitempty"` |
| ... | ... |
@@ -44,4 +47,8 @@ type Properties struct {
|
| 44 | 44 |
SharedMemoryRegionInfo []SharedMemoryRegionInfo `json:"SharedMemoryRegionInfo,omitempty"` |
| 45 | 45 |
|
| 46 | 46 |
GuestConnectionInfo *GuestConnectionInfo `json:"GuestConnectionInfo,omitempty"` |
| 47 |
+ |
|
| 48 |
+ // Metrics is not part of the API for HCS but this is used for LCOW v2 to |
|
| 49 |
+ // return the full cgroup metrics from the guest. |
|
| 50 |
+ Metrics *v1.Metrics `json:"LCOWMetrics,omitempty"` |
|
| 47 | 51 |
} |
| ... | ... |
@@ -9,8 +9,7 @@ |
| 9 | 9 |
|
| 10 | 10 |
package hcsschema |
| 11 | 11 |
|
| 12 |
-// By default the basic properties will be returned. This query provides a way to request specific properties. |
|
| 12 |
+// By default the basic properties will be returned. This query provides a way to request specific properties. |
|
| 13 | 13 |
type PropertyQuery struct {
|
| 14 |
- |
|
| 15 |
- PropertyTypes []string `json:"PropertyTypes,omitempty"` |
|
| 14 |
+ PropertyTypes []PropertyType `json:"PropertyTypes,omitempty"` |
|
| 16 | 15 |
} |
| 17 | 16 |
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 PropertyType string |
|
| 12 |
+ |
|
| 13 |
+const ( |
|
| 14 |
+ PTMemory PropertyType = "Memory" |
|
| 15 |
+ PTGuestMemory PropertyType = "GuestMemory" |
|
| 16 |
+ PTStatistics PropertyType = "Statistics" |
|
| 17 |
+ PTProcessList PropertyType = "ProcessList" |
|
| 18 |
+ PTTerminateOnLastHandleClosed PropertyType = "TerminateOnLastHandleClosed" |
|
| 19 |
+ PTSharedMemoryRegion PropertyType = "SharedMemoryRegion" |
|
| 20 |
+ PTGuestConnection PropertyType = "GuestConnection" |
|
| 21 |
+ PTICHeartbeatStatus PropertyType = "ICHeartbeatStatus" |
|
| 22 |
+) |
| ... | ... |
@@ -15,12 +15,11 @@ import ( |
| 15 | 15 |
|
| 16 | 16 |
// Runtime statistics for a container |
| 17 | 17 |
type Statistics struct {
|
| 18 |
- |
|
| 19 | 18 |
Timestamp time.Time `json:"Timestamp,omitempty"` |
| 20 | 19 |
|
| 21 | 20 |
ContainerStartTime time.Time `json:"ContainerStartTime,omitempty"` |
| 22 | 21 |
|
| 23 |
- Uptime100ns int32 `json:"Uptime100ns,omitempty"` |
|
| 22 |
+ Uptime100ns uint64 `json:"Uptime100ns,omitempty"` |
|
| 24 | 23 |
|
| 25 | 24 |
Processor *ProcessorStats `json:"Processor,omitempty"` |
| 26 | 25 |
|
| ... | ... |
@@ -11,12 +11,11 @@ package hcsschema |
| 11 | 11 |
|
| 12 | 12 |
// Storage runtime statistics |
| 13 | 13 |
type StorageStats struct {
|
| 14 |
+ ReadCountNormalized uint64 `json:"ReadCountNormalized,omitempty"` |
|
| 14 | 15 |
|
| 15 |
- ReadCountNormalized int32 `json:"ReadCountNormalized,omitempty"` |
|
| 16 |
+ ReadSizeBytes uint64 `json:"ReadSizeBytes,omitempty"` |
|
| 16 | 17 |
|
| 17 |
- ReadSizeBytes int32 `json:"ReadSizeBytes,omitempty"` |
|
| 18 |
+ WriteCountNormalized uint64 `json:"WriteCountNormalized,omitempty"` |
|
| 18 | 19 |
|
| 19 |
- WriteCountNormalized int32 `json:"WriteCountNormalized,omitempty"` |
|
| 20 |
- |
|
| 21 |
- WriteSizeBytes int32 `json:"WriteSizeBytes,omitempty"` |
|
| 20 |
+ WriteSizeBytes uint64 `json:"WriteSizeBytes,omitempty"` |
|
| 22 | 21 |
} |
| ... | ... |
@@ -10,14 +10,13 @@ |
| 10 | 10 |
package hcsschema |
| 11 | 11 |
|
| 12 | 12 |
type VmMemory struct {
|
| 13 |
- |
|
| 14 | 13 |
AvailableMemory int32 `json:"AvailableMemory,omitempty"` |
| 15 | 14 |
|
| 16 | 15 |
AvailableMemoryBuffer int32 `json:"AvailableMemoryBuffer,omitempty"` |
| 17 | 16 |
|
| 18 |
- ReservedMemory int32 `json:"ReservedMemory,omitempty"` |
|
| 17 |
+ ReservedMemory uint64 `json:"ReservedMemory,omitempty"` |
|
| 19 | 18 |
|
| 20 |
- AssignedMemory int32 `json:"AssignedMemory,omitempty"` |
|
| 19 |
+ AssignedMemory uint64 `json:"AssignedMemory,omitempty"` |
|
| 21 | 20 |
|
| 22 | 21 |
SlpActive bool `json:"SlpActive,omitempty"` |
| 23 | 22 |
|
| 17 | 16 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,565 @@ |
| 0 |
+package vmcompute |
|
| 1 |
+ |
|
| 2 |
+import ( |
|
| 3 |
+ gcontext "context" |
|
| 4 |
+ "syscall" |
|
| 5 |
+ "time" |
|
| 6 |
+ |
|
| 7 |
+ "github.com/Microsoft/hcsshim/internal/interop" |
|
| 8 |
+ "github.com/Microsoft/hcsshim/internal/log" |
|
| 9 |
+ "github.com/Microsoft/hcsshim/internal/logfields" |
|
| 10 |
+ "github.com/Microsoft/hcsshim/internal/oc" |
|
| 11 |
+ "github.com/Microsoft/hcsshim/internal/timeout" |
|
| 12 |
+ "go.opencensus.io/trace" |
|
| 13 |
+) |
|
| 14 |
+ |
|
| 15 |
+//go:generate go run ../../mksyscall_windows.go -output zsyscall_windows.go vmcompute.go |
|
| 16 |
+ |
|
| 17 |
+//sys hcsEnumerateComputeSystems(query string, computeSystems **uint16, result **uint16) (hr error) = vmcompute.HcsEnumerateComputeSystems? |
|
| 18 |
+//sys hcsCreateComputeSystem(id string, configuration string, identity syscall.Handle, computeSystem *HcsSystem, result **uint16) (hr error) = vmcompute.HcsCreateComputeSystem? |
|
| 19 |
+//sys hcsOpenComputeSystem(id string, computeSystem *HcsSystem, result **uint16) (hr error) = vmcompute.HcsOpenComputeSystem? |
|
| 20 |
+//sys hcsCloseComputeSystem(computeSystem HcsSystem) (hr error) = vmcompute.HcsCloseComputeSystem? |
|
| 21 |
+//sys hcsStartComputeSystem(computeSystem HcsSystem, options string, result **uint16) (hr error) = vmcompute.HcsStartComputeSystem? |
|
| 22 |
+//sys hcsShutdownComputeSystem(computeSystem HcsSystem, options string, result **uint16) (hr error) = vmcompute.HcsShutdownComputeSystem? |
|
| 23 |
+//sys hcsTerminateComputeSystem(computeSystem HcsSystem, options string, result **uint16) (hr error) = vmcompute.HcsTerminateComputeSystem? |
|
| 24 |
+//sys hcsPauseComputeSystem(computeSystem HcsSystem, options string, result **uint16) (hr error) = vmcompute.HcsPauseComputeSystem? |
|
| 25 |
+//sys hcsResumeComputeSystem(computeSystem HcsSystem, options string, result **uint16) (hr error) = vmcompute.HcsResumeComputeSystem? |
|
| 26 |
+//sys hcsGetComputeSystemProperties(computeSystem HcsSystem, propertyQuery string, properties **uint16, result **uint16) (hr error) = vmcompute.HcsGetComputeSystemProperties? |
|
| 27 |
+//sys hcsModifyComputeSystem(computeSystem HcsSystem, configuration string, result **uint16) (hr error) = vmcompute.HcsModifyComputeSystem? |
|
| 28 |
+//sys hcsRegisterComputeSystemCallback(computeSystem HcsSystem, callback uintptr, context uintptr, callbackHandle *HcsCallback) (hr error) = vmcompute.HcsRegisterComputeSystemCallback? |
|
| 29 |
+//sys hcsUnregisterComputeSystemCallback(callbackHandle HcsCallback) (hr error) = vmcompute.HcsUnregisterComputeSystemCallback? |
|
| 30 |
+ |
|
| 31 |
+//sys hcsCreateProcess(computeSystem HcsSystem, processParameters string, processInformation *HcsProcessInformation, process *HcsProcess, result **uint16) (hr error) = vmcompute.HcsCreateProcess? |
|
| 32 |
+//sys hcsOpenProcess(computeSystem HcsSystem, pid uint32, process *HcsProcess, result **uint16) (hr error) = vmcompute.HcsOpenProcess? |
|
| 33 |
+//sys hcsCloseProcess(process HcsProcess) (hr error) = vmcompute.HcsCloseProcess? |
|
| 34 |
+//sys hcsTerminateProcess(process HcsProcess, result **uint16) (hr error) = vmcompute.HcsTerminateProcess? |
|
| 35 |
+//sys hcsSignalProcess(process HcsProcess, options string, result **uint16) (hr error) = vmcompute.HcsSignalProcess? |
|
| 36 |
+//sys hcsGetProcessInfo(process HcsProcess, processInformation *HcsProcessInformation, result **uint16) (hr error) = vmcompute.HcsGetProcessInfo? |
|
| 37 |
+//sys hcsGetProcessProperties(process HcsProcess, processProperties **uint16, result **uint16) (hr error) = vmcompute.HcsGetProcessProperties? |
|
| 38 |
+//sys hcsModifyProcess(process HcsProcess, settings string, result **uint16) (hr error) = vmcompute.HcsModifyProcess? |
|
| 39 |
+//sys hcsGetServiceProperties(propertyQuery string, properties **uint16, result **uint16) (hr error) = vmcompute.HcsGetServiceProperties? |
|
| 40 |
+//sys hcsRegisterProcessCallback(process HcsProcess, callback uintptr, context uintptr, callbackHandle *HcsCallback) (hr error) = vmcompute.HcsRegisterProcessCallback? |
|
| 41 |
+//sys hcsUnregisterProcessCallback(callbackHandle HcsCallback) (hr error) = vmcompute.HcsUnregisterProcessCallback? |
|
| 42 |
+ |
|
| 43 |
+// errVmcomputeOperationPending is an error encountered when the operation is being completed asynchronously |
|
| 44 |
+const errVmcomputeOperationPending = syscall.Errno(0xC0370103) |
|
| 45 |
+ |
|
| 46 |
+// HcsSystem is the handle associated with a created compute system. |
|
| 47 |
+type HcsSystem syscall.Handle |
|
| 48 |
+ |
|
| 49 |
+// HcsProcess is the handle associated with a created process in a compute |
|
| 50 |
+// system. |
|
| 51 |
+type HcsProcess syscall.Handle |
|
| 52 |
+ |
|
| 53 |
+// HcsCallback is the handle associated with the function to call when events |
|
| 54 |
+// occur. |
|
| 55 |
+type HcsCallback syscall.Handle |
|
| 56 |
+ |
|
| 57 |
+// HcsProcessInformation is the structure used when creating or getting process |
|
| 58 |
+// info. |
|
| 59 |
+type HcsProcessInformation struct {
|
|
| 60 |
+ // ProcessId is the pid of the created process. |
|
| 61 |
+ ProcessId uint32 |
|
| 62 |
+ reserved uint32 |
|
| 63 |
+ // StdInput is the handle associated with the stdin of the process. |
|
| 64 |
+ StdInput syscall.Handle |
|
| 65 |
+ // StdOutput is the handle associated with the stdout of the process. |
|
| 66 |
+ StdOutput syscall.Handle |
|
| 67 |
+ // StdError is the handle associated with the stderr of the process. |
|
| 68 |
+ StdError syscall.Handle |
|
| 69 |
+} |
|
| 70 |
+ |
|
| 71 |
+func execute(ctx gcontext.Context, timeout time.Duration, f func() error) error {
|
|
| 72 |
+ if timeout > 0 {
|
|
| 73 |
+ var cancel gcontext.CancelFunc |
|
| 74 |
+ ctx, cancel = gcontext.WithTimeout(ctx, timeout) |
|
| 75 |
+ defer cancel() |
|
| 76 |
+ } |
|
| 77 |
+ |
|
| 78 |
+ done := make(chan error, 1) |
|
| 79 |
+ go func() {
|
|
| 80 |
+ done <- f() |
|
| 81 |
+ }() |
|
| 82 |
+ select {
|
|
| 83 |
+ case <-ctx.Done(): |
|
| 84 |
+ if ctx.Err() == gcontext.DeadlineExceeded {
|
|
| 85 |
+ log.G(ctx).WithField(logfields.Timeout, timeout). |
|
| 86 |
+ Warning("Syscall did not complete within operation timeout. This may indicate a platform issue. If it appears to be making no forward progress, obtain the stacks and see if there is a syscall stuck in the platform API for a significant length of time.")
|
|
| 87 |
+ } |
|
| 88 |
+ return ctx.Err() |
|
| 89 |
+ case err := <-done: |
|
| 90 |
+ return err |
|
| 91 |
+ } |
|
| 92 |
+} |
|
| 93 |
+ |
|
| 94 |
+func HcsEnumerateComputeSystems(ctx gcontext.Context, query string) (computeSystems, result string, hr error) {
|
|
| 95 |
+ ctx, span := trace.StartSpan(ctx, "HcsEnumerateComputeSystems") |
|
| 96 |
+ defer span.End() |
|
| 97 |
+ defer func() {
|
|
| 98 |
+ if result != "" {
|
|
| 99 |
+ span.AddAttributes(trace.StringAttribute("result", result))
|
|
| 100 |
+ } |
|
| 101 |
+ oc.SetSpanStatus(span, hr) |
|
| 102 |
+ }() |
|
| 103 |
+ span.AddAttributes(trace.StringAttribute("query", query))
|
|
| 104 |
+ |
|
| 105 |
+ return computeSystems, result, execute(ctx, timeout.SyscallWatcher, func() error {
|
|
| 106 |
+ var ( |
|
| 107 |
+ computeSystemsp *uint16 |
|
| 108 |
+ resultp *uint16 |
|
| 109 |
+ ) |
|
| 110 |
+ err := hcsEnumerateComputeSystems(query, &computeSystemsp, &resultp) |
|
| 111 |
+ if computeSystemsp != nil {
|
|
| 112 |
+ computeSystems = interop.ConvertAndFreeCoTaskMemString(computeSystemsp) |
|
| 113 |
+ } |
|
| 114 |
+ if resultp != nil {
|
|
| 115 |
+ result = interop.ConvertAndFreeCoTaskMemString(resultp) |
|
| 116 |
+ } |
|
| 117 |
+ return err |
|
| 118 |
+ }) |
|
| 119 |
+} |
|
| 120 |
+ |
|
| 121 |
+func HcsCreateComputeSystem(ctx gcontext.Context, id string, configuration string, identity syscall.Handle) (computeSystem HcsSystem, result string, hr error) {
|
|
| 122 |
+ ctx, span := trace.StartSpan(ctx, "HcsCreateComputeSystem") |
|
| 123 |
+ defer span.End() |
|
| 124 |
+ defer func() {
|
|
| 125 |
+ if result != "" {
|
|
| 126 |
+ span.AddAttributes(trace.StringAttribute("result", result))
|
|
| 127 |
+ } |
|
| 128 |
+ if hr != errVmcomputeOperationPending {
|
|
| 129 |
+ oc.SetSpanStatus(span, hr) |
|
| 130 |
+ } |
|
| 131 |
+ }() |
|
| 132 |
+ span.AddAttributes( |
|
| 133 |
+ trace.StringAttribute("id", id),
|
|
| 134 |
+ trace.StringAttribute("configuration", configuration))
|
|
| 135 |
+ |
|
| 136 |
+ return computeSystem, result, execute(ctx, timeout.SystemCreate, func() error {
|
|
| 137 |
+ var resultp *uint16 |
|
| 138 |
+ err := hcsCreateComputeSystem(id, configuration, identity, &computeSystem, &resultp) |
|
| 139 |
+ if resultp != nil {
|
|
| 140 |
+ result = interop.ConvertAndFreeCoTaskMemString(resultp) |
|
| 141 |
+ } |
|
| 142 |
+ return err |
|
| 143 |
+ }) |
|
| 144 |
+} |
|
| 145 |
+ |
|
| 146 |
+func HcsOpenComputeSystem(ctx gcontext.Context, id string) (computeSystem HcsSystem, result string, hr error) {
|
|
| 147 |
+ ctx, span := trace.StartSpan(ctx, "HcsOpenComputeSystem") |
|
| 148 |
+ defer span.End() |
|
| 149 |
+ defer func() {
|
|
| 150 |
+ if result != "" {
|
|
| 151 |
+ span.AddAttributes(trace.StringAttribute("result", result))
|
|
| 152 |
+ } |
|
| 153 |
+ oc.SetSpanStatus(span, hr) |
|
| 154 |
+ }() |
|
| 155 |
+ |
|
| 156 |
+ return computeSystem, result, execute(ctx, timeout.SyscallWatcher, func() error {
|
|
| 157 |
+ var resultp *uint16 |
|
| 158 |
+ err := hcsOpenComputeSystem(id, &computeSystem, &resultp) |
|
| 159 |
+ if resultp != nil {
|
|
| 160 |
+ result = interop.ConvertAndFreeCoTaskMemString(resultp) |
|
| 161 |
+ } |
|
| 162 |
+ return err |
|
| 163 |
+ }) |
|
| 164 |
+} |
|
| 165 |
+ |
|
| 166 |
+func HcsCloseComputeSystem(ctx gcontext.Context, computeSystem HcsSystem) (hr error) {
|
|
| 167 |
+ ctx, span := trace.StartSpan(ctx, "HcsCloseComputeSystem") |
|
| 168 |
+ defer span.End() |
|
| 169 |
+ defer func() { oc.SetSpanStatus(span, hr) }()
|
|
| 170 |
+ |
|
| 171 |
+ return execute(ctx, timeout.SyscallWatcher, func() error {
|
|
| 172 |
+ return hcsCloseComputeSystem(computeSystem) |
|
| 173 |
+ }) |
|
| 174 |
+} |
|
| 175 |
+ |
|
| 176 |
+func HcsStartComputeSystem(ctx gcontext.Context, computeSystem HcsSystem, options string) (result string, hr error) {
|
|
| 177 |
+ ctx, span := trace.StartSpan(ctx, "HcsStartComputeSystem") |
|
| 178 |
+ defer span.End() |
|
| 179 |
+ defer func() {
|
|
| 180 |
+ if result != "" {
|
|
| 181 |
+ span.AddAttributes(trace.StringAttribute("result", result))
|
|
| 182 |
+ } |
|
| 183 |
+ if hr != errVmcomputeOperationPending {
|
|
| 184 |
+ oc.SetSpanStatus(span, hr) |
|
| 185 |
+ } |
|
| 186 |
+ }() |
|
| 187 |
+ span.AddAttributes(trace.StringAttribute("options", options))
|
|
| 188 |
+ |
|
| 189 |
+ return result, execute(ctx, timeout.SystemStart, func() error {
|
|
| 190 |
+ var resultp *uint16 |
|
| 191 |
+ err := hcsStartComputeSystem(computeSystem, options, &resultp) |
|
| 192 |
+ if resultp != nil {
|
|
| 193 |
+ result = interop.ConvertAndFreeCoTaskMemString(resultp) |
|
| 194 |
+ } |
|
| 195 |
+ return err |
|
| 196 |
+ }) |
|
| 197 |
+} |
|
| 198 |
+ |
|
| 199 |
+func HcsShutdownComputeSystem(ctx gcontext.Context, computeSystem HcsSystem, options string) (result string, hr error) {
|
|
| 200 |
+ ctx, span := trace.StartSpan(ctx, "HcsShutdownComputeSystem") |
|
| 201 |
+ defer span.End() |
|
| 202 |
+ defer func() {
|
|
| 203 |
+ if result != "" {
|
|
| 204 |
+ span.AddAttributes(trace.StringAttribute("result", result))
|
|
| 205 |
+ } |
|
| 206 |
+ if hr != errVmcomputeOperationPending {
|
|
| 207 |
+ oc.SetSpanStatus(span, hr) |
|
| 208 |
+ } |
|
| 209 |
+ }() |
|
| 210 |
+ span.AddAttributes(trace.StringAttribute("options", options))
|
|
| 211 |
+ |
|
| 212 |
+ return result, execute(ctx, timeout.SyscallWatcher, func() error {
|
|
| 213 |
+ var resultp *uint16 |
|
| 214 |
+ err := hcsShutdownComputeSystem(computeSystem, options, &resultp) |
|
| 215 |
+ if resultp != nil {
|
|
| 216 |
+ result = interop.ConvertAndFreeCoTaskMemString(resultp) |
|
| 217 |
+ } |
|
| 218 |
+ return err |
|
| 219 |
+ }) |
|
| 220 |
+} |
|
| 221 |
+ |
|
| 222 |
+func HcsTerminateComputeSystem(ctx gcontext.Context, computeSystem HcsSystem, options string) (result string, hr error) {
|
|
| 223 |
+ ctx, span := trace.StartSpan(ctx, "HcsTerminateComputeSystem") |
|
| 224 |
+ defer span.End() |
|
| 225 |
+ defer func() {
|
|
| 226 |
+ if result != "" {
|
|
| 227 |
+ span.AddAttributes(trace.StringAttribute("result", result))
|
|
| 228 |
+ } |
|
| 229 |
+ if hr != errVmcomputeOperationPending {
|
|
| 230 |
+ oc.SetSpanStatus(span, hr) |
|
| 231 |
+ } |
|
| 232 |
+ }() |
|
| 233 |
+ span.AddAttributes(trace.StringAttribute("options", options))
|
|
| 234 |
+ |
|
| 235 |
+ return result, execute(ctx, timeout.SyscallWatcher, func() error {
|
|
| 236 |
+ var resultp *uint16 |
|
| 237 |
+ err := hcsTerminateComputeSystem(computeSystem, options, &resultp) |
|
| 238 |
+ if resultp != nil {
|
|
| 239 |
+ result = interop.ConvertAndFreeCoTaskMemString(resultp) |
|
| 240 |
+ } |
|
| 241 |
+ return err |
|
| 242 |
+ }) |
|
| 243 |
+} |
|
| 244 |
+ |
|
| 245 |
+func HcsPauseComputeSystem(ctx gcontext.Context, computeSystem HcsSystem, options string) (result string, hr error) {
|
|
| 246 |
+ ctx, span := trace.StartSpan(ctx, "HcsPauseComputeSystem") |
|
| 247 |
+ defer span.End() |
|
| 248 |
+ defer func() {
|
|
| 249 |
+ if result != "" {
|
|
| 250 |
+ span.AddAttributes(trace.StringAttribute("result", result))
|
|
| 251 |
+ } |
|
| 252 |
+ if hr != errVmcomputeOperationPending {
|
|
| 253 |
+ oc.SetSpanStatus(span, hr) |
|
| 254 |
+ } |
|
| 255 |
+ }() |
|
| 256 |
+ span.AddAttributes(trace.StringAttribute("options", options))
|
|
| 257 |
+ |
|
| 258 |
+ return result, execute(ctx, timeout.SystemPause, func() error {
|
|
| 259 |
+ var resultp *uint16 |
|
| 260 |
+ err := hcsPauseComputeSystem(computeSystem, options, &resultp) |
|
| 261 |
+ if resultp != nil {
|
|
| 262 |
+ result = interop.ConvertAndFreeCoTaskMemString(resultp) |
|
| 263 |
+ } |
|
| 264 |
+ return err |
|
| 265 |
+ }) |
|
| 266 |
+} |
|
| 267 |
+ |
|
| 268 |
+func HcsResumeComputeSystem(ctx gcontext.Context, computeSystem HcsSystem, options string) (result string, hr error) {
|
|
| 269 |
+ ctx, span := trace.StartSpan(ctx, "HcsResumeComputeSystem") |
|
| 270 |
+ defer span.End() |
|
| 271 |
+ defer func() {
|
|
| 272 |
+ if result != "" {
|
|
| 273 |
+ span.AddAttributes(trace.StringAttribute("result", result))
|
|
| 274 |
+ } |
|
| 275 |
+ if hr != errVmcomputeOperationPending {
|
|
| 276 |
+ oc.SetSpanStatus(span, hr) |
|
| 277 |
+ } |
|
| 278 |
+ }() |
|
| 279 |
+ span.AddAttributes(trace.StringAttribute("options", options))
|
|
| 280 |
+ |
|
| 281 |
+ return result, execute(ctx, timeout.SystemResume, func() error {
|
|
| 282 |
+ var resultp *uint16 |
|
| 283 |
+ err := hcsResumeComputeSystem(computeSystem, options, &resultp) |
|
| 284 |
+ if resultp != nil {
|
|
| 285 |
+ result = interop.ConvertAndFreeCoTaskMemString(resultp) |
|
| 286 |
+ } |
|
| 287 |
+ return err |
|
| 288 |
+ }) |
|
| 289 |
+} |
|
| 290 |
+ |
|
| 291 |
+func HcsGetComputeSystemProperties(ctx gcontext.Context, computeSystem HcsSystem, propertyQuery string) (properties, result string, hr error) {
|
|
| 292 |
+ ctx, span := trace.StartSpan(ctx, "HcsGetComputeSystemProperties") |
|
| 293 |
+ defer span.End() |
|
| 294 |
+ defer func() {
|
|
| 295 |
+ if result != "" {
|
|
| 296 |
+ span.AddAttributes(trace.StringAttribute("result", result))
|
|
| 297 |
+ } |
|
| 298 |
+ oc.SetSpanStatus(span, hr) |
|
| 299 |
+ }() |
|
| 300 |
+ span.AddAttributes(trace.StringAttribute("propertyQuery", propertyQuery))
|
|
| 301 |
+ |
|
| 302 |
+ return properties, result, execute(ctx, timeout.SyscallWatcher, func() error {
|
|
| 303 |
+ var ( |
|
| 304 |
+ propertiesp *uint16 |
|
| 305 |
+ resultp *uint16 |
|
| 306 |
+ ) |
|
| 307 |
+ err := hcsGetComputeSystemProperties(computeSystem, propertyQuery, &propertiesp, &resultp) |
|
| 308 |
+ if propertiesp != nil {
|
|
| 309 |
+ properties = interop.ConvertAndFreeCoTaskMemString(propertiesp) |
|
| 310 |
+ } |
|
| 311 |
+ if resultp != nil {
|
|
| 312 |
+ result = interop.ConvertAndFreeCoTaskMemString(resultp) |
|
| 313 |
+ } |
|
| 314 |
+ return err |
|
| 315 |
+ }) |
|
| 316 |
+} |
|
| 317 |
+ |
|
| 318 |
+func HcsModifyComputeSystem(ctx gcontext.Context, computeSystem HcsSystem, configuration string) (result string, hr error) {
|
|
| 319 |
+ ctx, span := trace.StartSpan(ctx, "HcsModifyComputeSystem") |
|
| 320 |
+ defer span.End() |
|
| 321 |
+ defer func() {
|
|
| 322 |
+ if result != "" {
|
|
| 323 |
+ span.AddAttributes(trace.StringAttribute("result", result))
|
|
| 324 |
+ } |
|
| 325 |
+ oc.SetSpanStatus(span, hr) |
|
| 326 |
+ }() |
|
| 327 |
+ span.AddAttributes(trace.StringAttribute("configuration", configuration))
|
|
| 328 |
+ |
|
| 329 |
+ return result, execute(ctx, timeout.SyscallWatcher, func() error {
|
|
| 330 |
+ var resultp *uint16 |
|
| 331 |
+ err := hcsModifyComputeSystem(computeSystem, configuration, &resultp) |
|
| 332 |
+ if resultp != nil {
|
|
| 333 |
+ result = interop.ConvertAndFreeCoTaskMemString(resultp) |
|
| 334 |
+ } |
|
| 335 |
+ return err |
|
| 336 |
+ }) |
|
| 337 |
+} |
|
| 338 |
+ |
|
| 339 |
+func HcsRegisterComputeSystemCallback(ctx gcontext.Context, computeSystem HcsSystem, callback uintptr, context uintptr) (callbackHandle HcsCallback, hr error) {
|
|
| 340 |
+ ctx, span := trace.StartSpan(ctx, "HcsRegisterComputeSystemCallback") |
|
| 341 |
+ defer span.End() |
|
| 342 |
+ defer func() { oc.SetSpanStatus(span, hr) }()
|
|
| 343 |
+ |
|
| 344 |
+ return callbackHandle, execute(ctx, timeout.SyscallWatcher, func() error {
|
|
| 345 |
+ return hcsRegisterComputeSystemCallback(computeSystem, callback, context, &callbackHandle) |
|
| 346 |
+ }) |
|
| 347 |
+} |
|
| 348 |
+ |
|
| 349 |
+func HcsUnregisterComputeSystemCallback(ctx gcontext.Context, callbackHandle HcsCallback) (hr error) {
|
|
| 350 |
+ ctx, span := trace.StartSpan(ctx, "HcsUnregisterComputeSystemCallback") |
|
| 351 |
+ defer span.End() |
|
| 352 |
+ defer func() { oc.SetSpanStatus(span, hr) }()
|
|
| 353 |
+ |
|
| 354 |
+ return execute(ctx, timeout.SyscallWatcher, func() error {
|
|
| 355 |
+ return hcsUnregisterComputeSystemCallback(callbackHandle) |
|
| 356 |
+ }) |
|
| 357 |
+} |
|
| 358 |
+ |
|
| 359 |
+func HcsCreateProcess(ctx gcontext.Context, computeSystem HcsSystem, processParameters string) (processInformation HcsProcessInformation, process HcsProcess, result string, hr error) {
|
|
| 360 |
+ ctx, span := trace.StartSpan(ctx, "HcsCreateProcess") |
|
| 361 |
+ defer span.End() |
|
| 362 |
+ defer func() {
|
|
| 363 |
+ if result != "" {
|
|
| 364 |
+ span.AddAttributes(trace.StringAttribute("result", result))
|
|
| 365 |
+ } |
|
| 366 |
+ oc.SetSpanStatus(span, hr) |
|
| 367 |
+ }() |
|
| 368 |
+ span.AddAttributes(trace.StringAttribute("processParameters", processParameters))
|
|
| 369 |
+ |
|
| 370 |
+ return processInformation, process, result, execute(ctx, timeout.SyscallWatcher, func() error {
|
|
| 371 |
+ var resultp *uint16 |
|
| 372 |
+ err := hcsCreateProcess(computeSystem, processParameters, &processInformation, &process, &resultp) |
|
| 373 |
+ if resultp != nil {
|
|
| 374 |
+ result = interop.ConvertAndFreeCoTaskMemString(resultp) |
|
| 375 |
+ } |
|
| 376 |
+ return err |
|
| 377 |
+ }) |
|
| 378 |
+} |
|
| 379 |
+ |
|
| 380 |
+func HcsOpenProcess(ctx gcontext.Context, computeSystem HcsSystem, pid uint32) (process HcsProcess, result string, hr error) {
|
|
| 381 |
+ ctx, span := trace.StartSpan(ctx, "HcsOpenProcess") |
|
| 382 |
+ defer span.End() |
|
| 383 |
+ defer func() {
|
|
| 384 |
+ if result != "" {
|
|
| 385 |
+ span.AddAttributes(trace.StringAttribute("result", result))
|
|
| 386 |
+ } |
|
| 387 |
+ oc.SetSpanStatus(span, hr) |
|
| 388 |
+ }() |
|
| 389 |
+ span.AddAttributes(trace.Int64Attribute("pid", int64(pid)))
|
|
| 390 |
+ |
|
| 391 |
+ return process, result, execute(ctx, timeout.SyscallWatcher, func() error {
|
|
| 392 |
+ var resultp *uint16 |
|
| 393 |
+ err := hcsOpenProcess(computeSystem, pid, &process, &resultp) |
|
| 394 |
+ if resultp != nil {
|
|
| 395 |
+ result = interop.ConvertAndFreeCoTaskMemString(resultp) |
|
| 396 |
+ } |
|
| 397 |
+ return err |
|
| 398 |
+ }) |
|
| 399 |
+} |
|
| 400 |
+ |
|
| 401 |
+func HcsCloseProcess(ctx gcontext.Context, process HcsProcess) (hr error) {
|
|
| 402 |
+ ctx, span := trace.StartSpan(ctx, "HcsCloseProcess") |
|
| 403 |
+ defer span.End() |
|
| 404 |
+ defer func() { oc.SetSpanStatus(span, hr) }()
|
|
| 405 |
+ |
|
| 406 |
+ return execute(ctx, timeout.SyscallWatcher, func() error {
|
|
| 407 |
+ return hcsCloseProcess(process) |
|
| 408 |
+ }) |
|
| 409 |
+} |
|
| 410 |
+ |
|
| 411 |
+func HcsTerminateProcess(ctx gcontext.Context, process HcsProcess) (result string, hr error) {
|
|
| 412 |
+ ctx, span := trace.StartSpan(ctx, "HcsTerminateProcess") |
|
| 413 |
+ defer span.End() |
|
| 414 |
+ defer func() {
|
|
| 415 |
+ if result != "" {
|
|
| 416 |
+ span.AddAttributes(trace.StringAttribute("result", result))
|
|
| 417 |
+ } |
|
| 418 |
+ oc.SetSpanStatus(span, hr) |
|
| 419 |
+ }() |
|
| 420 |
+ |
|
| 421 |
+ return result, execute(ctx, timeout.SyscallWatcher, func() error {
|
|
| 422 |
+ var resultp *uint16 |
|
| 423 |
+ err := hcsTerminateProcess(process, &resultp) |
|
| 424 |
+ if resultp != nil {
|
|
| 425 |
+ result = interop.ConvertAndFreeCoTaskMemString(resultp) |
|
| 426 |
+ } |
|
| 427 |
+ return err |
|
| 428 |
+ }) |
|
| 429 |
+} |
|
| 430 |
+ |
|
| 431 |
+func HcsSignalProcess(ctx gcontext.Context, process HcsProcess, options string) (result string, hr error) {
|
|
| 432 |
+ ctx, span := trace.StartSpan(ctx, "HcsSignalProcess") |
|
| 433 |
+ defer span.End() |
|
| 434 |
+ defer func() {
|
|
| 435 |
+ if result != "" {
|
|
| 436 |
+ span.AddAttributes(trace.StringAttribute("result", result))
|
|
| 437 |
+ } |
|
| 438 |
+ oc.SetSpanStatus(span, hr) |
|
| 439 |
+ }() |
|
| 440 |
+ span.AddAttributes(trace.StringAttribute("options", options))
|
|
| 441 |
+ |
|
| 442 |
+ return result, execute(ctx, timeout.SyscallWatcher, func() error {
|
|
| 443 |
+ var resultp *uint16 |
|
| 444 |
+ err := hcsSignalProcess(process, options, &resultp) |
|
| 445 |
+ if resultp != nil {
|
|
| 446 |
+ result = interop.ConvertAndFreeCoTaskMemString(resultp) |
|
| 447 |
+ } |
|
| 448 |
+ return err |
|
| 449 |
+ }) |
|
| 450 |
+} |
|
| 451 |
+ |
|
| 452 |
+func HcsGetProcessInfo(ctx gcontext.Context, process HcsProcess) (processInformation HcsProcessInformation, result string, hr error) {
|
|
| 453 |
+ ctx, span := trace.StartSpan(ctx, "HcsGetProcessInfo") |
|
| 454 |
+ defer span.End() |
|
| 455 |
+ defer func() {
|
|
| 456 |
+ if result != "" {
|
|
| 457 |
+ span.AddAttributes(trace.StringAttribute("result", result))
|
|
| 458 |
+ } |
|
| 459 |
+ oc.SetSpanStatus(span, hr) |
|
| 460 |
+ }() |
|
| 461 |
+ |
|
| 462 |
+ return processInformation, result, execute(ctx, timeout.SyscallWatcher, func() error {
|
|
| 463 |
+ var resultp *uint16 |
|
| 464 |
+ err := hcsGetProcessInfo(process, &processInformation, &resultp) |
|
| 465 |
+ if resultp != nil {
|
|
| 466 |
+ result = interop.ConvertAndFreeCoTaskMemString(resultp) |
|
| 467 |
+ } |
|
| 468 |
+ return err |
|
| 469 |
+ }) |
|
| 470 |
+} |
|
| 471 |
+ |
|
| 472 |
+func HcsGetProcessProperties(ctx gcontext.Context, process HcsProcess) (processProperties, result string, hr error) {
|
|
| 473 |
+ ctx, span := trace.StartSpan(ctx, "HcsGetProcessProperties") |
|
| 474 |
+ defer span.End() |
|
| 475 |
+ defer func() {
|
|
| 476 |
+ if result != "" {
|
|
| 477 |
+ span.AddAttributes(trace.StringAttribute("result", result))
|
|
| 478 |
+ } |
|
| 479 |
+ oc.SetSpanStatus(span, hr) |
|
| 480 |
+ }() |
|
| 481 |
+ |
|
| 482 |
+ return processProperties, result, execute(ctx, timeout.SyscallWatcher, func() error {
|
|
| 483 |
+ var ( |
|
| 484 |
+ processPropertiesp *uint16 |
|
| 485 |
+ resultp *uint16 |
|
| 486 |
+ ) |
|
| 487 |
+ err := hcsGetProcessProperties(process, &processPropertiesp, &resultp) |
|
| 488 |
+ if processPropertiesp != nil {
|
|
| 489 |
+ processProperties = interop.ConvertAndFreeCoTaskMemString(processPropertiesp) |
|
| 490 |
+ } |
|
| 491 |
+ if resultp != nil {
|
|
| 492 |
+ result = interop.ConvertAndFreeCoTaskMemString(resultp) |
|
| 493 |
+ } |
|
| 494 |
+ return err |
|
| 495 |
+ }) |
|
| 496 |
+} |
|
| 497 |
+ |
|
| 498 |
+func HcsModifyProcess(ctx gcontext.Context, process HcsProcess, settings string) (result string, hr error) {
|
|
| 499 |
+ ctx, span := trace.StartSpan(ctx, "HcsModifyProcess") |
|
| 500 |
+ defer span.End() |
|
| 501 |
+ defer func() {
|
|
| 502 |
+ if result != "" {
|
|
| 503 |
+ span.AddAttributes(trace.StringAttribute("result", result))
|
|
| 504 |
+ } |
|
| 505 |
+ oc.SetSpanStatus(span, hr) |
|
| 506 |
+ }() |
|
| 507 |
+ span.AddAttributes(trace.StringAttribute("settings", settings))
|
|
| 508 |
+ |
|
| 509 |
+ return result, execute(ctx, timeout.SyscallWatcher, func() error {
|
|
| 510 |
+ var resultp *uint16 |
|
| 511 |
+ err := hcsModifyProcess(process, settings, &resultp) |
|
| 512 |
+ if resultp != nil {
|
|
| 513 |
+ result = interop.ConvertAndFreeCoTaskMemString(resultp) |
|
| 514 |
+ } |
|
| 515 |
+ return err |
|
| 516 |
+ }) |
|
| 517 |
+} |
|
| 518 |
+ |
|
| 519 |
+func HcsGetServiceProperties(ctx gcontext.Context, propertyQuery string) (properties, result string, hr error) {
|
|
| 520 |
+ ctx, span := trace.StartSpan(ctx, "HcsGetServiceProperties") |
|
| 521 |
+ defer span.End() |
|
| 522 |
+ defer func() {
|
|
| 523 |
+ if result != "" {
|
|
| 524 |
+ span.AddAttributes(trace.StringAttribute("result", result))
|
|
| 525 |
+ } |
|
| 526 |
+ oc.SetSpanStatus(span, hr) |
|
| 527 |
+ }() |
|
| 528 |
+ span.AddAttributes(trace.StringAttribute("propertyQuery", propertyQuery))
|
|
| 529 |
+ |
|
| 530 |
+ return properties, result, execute(ctx, timeout.SyscallWatcher, func() error {
|
|
| 531 |
+ var ( |
|
| 532 |
+ propertiesp *uint16 |
|
| 533 |
+ resultp *uint16 |
|
| 534 |
+ ) |
|
| 535 |
+ err := hcsGetServiceProperties(propertyQuery, &propertiesp, &resultp) |
|
| 536 |
+ if propertiesp != nil {
|
|
| 537 |
+ properties = interop.ConvertAndFreeCoTaskMemString(propertiesp) |
|
| 538 |
+ } |
|
| 539 |
+ if resultp != nil {
|
|
| 540 |
+ result = interop.ConvertAndFreeCoTaskMemString(resultp) |
|
| 541 |
+ } |
|
| 542 |
+ return err |
|
| 543 |
+ }) |
|
| 544 |
+} |
|
| 545 |
+ |
|
| 546 |
+func HcsRegisterProcessCallback(ctx gcontext.Context, process HcsProcess, callback uintptr, context uintptr) (callbackHandle HcsCallback, hr error) {
|
|
| 547 |
+ ctx, span := trace.StartSpan(ctx, "HcsRegisterProcessCallback") |
|
| 548 |
+ defer span.End() |
|
| 549 |
+ defer func() { oc.SetSpanStatus(span, hr) }()
|
|
| 550 |
+ |
|
| 551 |
+ return callbackHandle, execute(ctx, timeout.SyscallWatcher, func() error {
|
|
| 552 |
+ return hcsRegisterProcessCallback(process, callback, context, &callbackHandle) |
|
| 553 |
+ }) |
|
| 554 |
+} |
|
| 555 |
+ |
|
| 556 |
+func HcsUnregisterProcessCallback(ctx gcontext.Context, callbackHandle HcsCallback) (hr error) {
|
|
| 557 |
+ ctx, span := trace.StartSpan(ctx, "HcsUnregisterProcessCallback") |
|
| 558 |
+ defer span.End() |
|
| 559 |
+ defer func() { oc.SetSpanStatus(span, hr) }()
|
|
| 560 |
+ |
|
| 561 |
+ return execute(ctx, timeout.SyscallWatcher, func() error {
|
|
| 562 |
+ return hcsUnregisterProcessCallback(callbackHandle) |
|
| 563 |
+ }) |
|
| 564 |
+} |
| 0 | 565 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,533 @@ |
| 0 |
+// Code generated mksyscall_windows.exe DO NOT EDIT |
|
| 1 |
+ |
|
| 2 |
+package vmcompute |
|
| 3 |
+ |
|
| 4 |
+import ( |
|
| 5 |
+ "syscall" |
|
| 6 |
+ "unsafe" |
|
| 7 |
+ |
|
| 8 |
+ "golang.org/x/sys/windows" |
|
| 9 |
+) |
|
| 10 |
+ |
|
| 11 |
+var _ unsafe.Pointer |
|
| 12 |
+ |
|
| 13 |
+// Do the interface allocations only once for common |
|
| 14 |
+// Errno values. |
|
| 15 |
+const ( |
|
| 16 |
+ errnoERROR_IO_PENDING = 997 |
|
| 17 |
+) |
|
| 18 |
+ |
|
| 19 |
+var ( |
|
| 20 |
+ errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING) |
|
| 21 |
+) |
|
| 22 |
+ |
|
| 23 |
+// errnoErr returns common boxed Errno values, to prevent |
|
| 24 |
+// allocations at runtime. |
|
| 25 |
+func errnoErr(e syscall.Errno) error {
|
|
| 26 |
+ switch e {
|
|
| 27 |
+ case 0: |
|
| 28 |
+ return nil |
|
| 29 |
+ case errnoERROR_IO_PENDING: |
|
| 30 |
+ return errERROR_IO_PENDING |
|
| 31 |
+ } |
|
| 32 |
+ // TODO: add more here, after collecting data on the common |
|
| 33 |
+ // error values see on Windows. (perhaps when running |
|
| 34 |
+ // all.bat?) |
|
| 35 |
+ return e |
|
| 36 |
+} |
|
| 37 |
+ |
|
| 38 |
+var ( |
|
| 39 |
+ modvmcompute = windows.NewLazySystemDLL("vmcompute.dll")
|
|
| 40 |
+ |
|
| 41 |
+ procHcsEnumerateComputeSystems = modvmcompute.NewProc("HcsEnumerateComputeSystems")
|
|
| 42 |
+ procHcsCreateComputeSystem = modvmcompute.NewProc("HcsCreateComputeSystem")
|
|
| 43 |
+ procHcsOpenComputeSystem = modvmcompute.NewProc("HcsOpenComputeSystem")
|
|
| 44 |
+ procHcsCloseComputeSystem = modvmcompute.NewProc("HcsCloseComputeSystem")
|
|
| 45 |
+ procHcsStartComputeSystem = modvmcompute.NewProc("HcsStartComputeSystem")
|
|
| 46 |
+ procHcsShutdownComputeSystem = modvmcompute.NewProc("HcsShutdownComputeSystem")
|
|
| 47 |
+ procHcsTerminateComputeSystem = modvmcompute.NewProc("HcsTerminateComputeSystem")
|
|
| 48 |
+ procHcsPauseComputeSystem = modvmcompute.NewProc("HcsPauseComputeSystem")
|
|
| 49 |
+ procHcsResumeComputeSystem = modvmcompute.NewProc("HcsResumeComputeSystem")
|
|
| 50 |
+ procHcsGetComputeSystemProperties = modvmcompute.NewProc("HcsGetComputeSystemProperties")
|
|
| 51 |
+ procHcsModifyComputeSystem = modvmcompute.NewProc("HcsModifyComputeSystem")
|
|
| 52 |
+ procHcsRegisterComputeSystemCallback = modvmcompute.NewProc("HcsRegisterComputeSystemCallback")
|
|
| 53 |
+ procHcsUnregisterComputeSystemCallback = modvmcompute.NewProc("HcsUnregisterComputeSystemCallback")
|
|
| 54 |
+ procHcsCreateProcess = modvmcompute.NewProc("HcsCreateProcess")
|
|
| 55 |
+ procHcsOpenProcess = modvmcompute.NewProc("HcsOpenProcess")
|
|
| 56 |
+ procHcsCloseProcess = modvmcompute.NewProc("HcsCloseProcess")
|
|
| 57 |
+ procHcsTerminateProcess = modvmcompute.NewProc("HcsTerminateProcess")
|
|
| 58 |
+ procHcsSignalProcess = modvmcompute.NewProc("HcsSignalProcess")
|
|
| 59 |
+ procHcsGetProcessInfo = modvmcompute.NewProc("HcsGetProcessInfo")
|
|
| 60 |
+ procHcsGetProcessProperties = modvmcompute.NewProc("HcsGetProcessProperties")
|
|
| 61 |
+ procHcsModifyProcess = modvmcompute.NewProc("HcsModifyProcess")
|
|
| 62 |
+ procHcsGetServiceProperties = modvmcompute.NewProc("HcsGetServiceProperties")
|
|
| 63 |
+ procHcsRegisterProcessCallback = modvmcompute.NewProc("HcsRegisterProcessCallback")
|
|
| 64 |
+ procHcsUnregisterProcessCallback = modvmcompute.NewProc("HcsUnregisterProcessCallback")
|
|
| 65 |
+) |
|
| 66 |
+ |
|
| 67 |
+func hcsEnumerateComputeSystems(query string, computeSystems **uint16, result **uint16) (hr error) {
|
|
| 68 |
+ var _p0 *uint16 |
|
| 69 |
+ _p0, hr = syscall.UTF16PtrFromString(query) |
|
| 70 |
+ if hr != nil {
|
|
| 71 |
+ return |
|
| 72 |
+ } |
|
| 73 |
+ return _hcsEnumerateComputeSystems(_p0, computeSystems, result) |
|
| 74 |
+} |
|
| 75 |
+ |
|
| 76 |
+func _hcsEnumerateComputeSystems(query *uint16, computeSystems **uint16, result **uint16) (hr error) {
|
|
| 77 |
+ if hr = procHcsEnumerateComputeSystems.Find(); hr != nil {
|
|
| 78 |
+ return |
|
| 79 |
+ } |
|
| 80 |
+ r0, _, _ := syscall.Syscall(procHcsEnumerateComputeSystems.Addr(), 3, uintptr(unsafe.Pointer(query)), uintptr(unsafe.Pointer(computeSystems)), uintptr(unsafe.Pointer(result))) |
|
| 81 |
+ if int32(r0) < 0 {
|
|
| 82 |
+ if r0&0x1fff0000 == 0x00070000 {
|
|
| 83 |
+ r0 &= 0xffff |
|
| 84 |
+ } |
|
| 85 |
+ hr = syscall.Errno(r0) |
|
| 86 |
+ } |
|
| 87 |
+ return |
|
| 88 |
+} |
|
| 89 |
+ |
|
| 90 |
+func hcsCreateComputeSystem(id string, configuration string, identity syscall.Handle, computeSystem *HcsSystem, result **uint16) (hr error) {
|
|
| 91 |
+ var _p0 *uint16 |
|
| 92 |
+ _p0, hr = syscall.UTF16PtrFromString(id) |
|
| 93 |
+ if hr != nil {
|
|
| 94 |
+ return |
|
| 95 |
+ } |
|
| 96 |
+ var _p1 *uint16 |
|
| 97 |
+ _p1, hr = syscall.UTF16PtrFromString(configuration) |
|
| 98 |
+ if hr != nil {
|
|
| 99 |
+ return |
|
| 100 |
+ } |
|
| 101 |
+ return _hcsCreateComputeSystem(_p0, _p1, identity, computeSystem, result) |
|
| 102 |
+} |
|
| 103 |
+ |
|
| 104 |
+func _hcsCreateComputeSystem(id *uint16, configuration *uint16, identity syscall.Handle, computeSystem *HcsSystem, result **uint16) (hr error) {
|
|
| 105 |
+ if hr = procHcsCreateComputeSystem.Find(); hr != nil {
|
|
| 106 |
+ return |
|
| 107 |
+ } |
|
| 108 |
+ r0, _, _ := syscall.Syscall6(procHcsCreateComputeSystem.Addr(), 5, uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(configuration)), uintptr(identity), uintptr(unsafe.Pointer(computeSystem)), uintptr(unsafe.Pointer(result)), 0) |
|
| 109 |
+ if int32(r0) < 0 {
|
|
| 110 |
+ if r0&0x1fff0000 == 0x00070000 {
|
|
| 111 |
+ r0 &= 0xffff |
|
| 112 |
+ } |
|
| 113 |
+ hr = syscall.Errno(r0) |
|
| 114 |
+ } |
|
| 115 |
+ return |
|
| 116 |
+} |
|
| 117 |
+ |
|
| 118 |
+func hcsOpenComputeSystem(id string, computeSystem *HcsSystem, result **uint16) (hr error) {
|
|
| 119 |
+ var _p0 *uint16 |
|
| 120 |
+ _p0, hr = syscall.UTF16PtrFromString(id) |
|
| 121 |
+ if hr != nil {
|
|
| 122 |
+ return |
|
| 123 |
+ } |
|
| 124 |
+ return _hcsOpenComputeSystem(_p0, computeSystem, result) |
|
| 125 |
+} |
|
| 126 |
+ |
|
| 127 |
+func _hcsOpenComputeSystem(id *uint16, computeSystem *HcsSystem, result **uint16) (hr error) {
|
|
| 128 |
+ if hr = procHcsOpenComputeSystem.Find(); hr != nil {
|
|
| 129 |
+ return |
|
| 130 |
+ } |
|
| 131 |
+ r0, _, _ := syscall.Syscall(procHcsOpenComputeSystem.Addr(), 3, uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(computeSystem)), uintptr(unsafe.Pointer(result))) |
|
| 132 |
+ if int32(r0) < 0 {
|
|
| 133 |
+ if r0&0x1fff0000 == 0x00070000 {
|
|
| 134 |
+ r0 &= 0xffff |
|
| 135 |
+ } |
|
| 136 |
+ hr = syscall.Errno(r0) |
|
| 137 |
+ } |
|
| 138 |
+ return |
|
| 139 |
+} |
|
| 140 |
+ |
|
| 141 |
+func hcsCloseComputeSystem(computeSystem HcsSystem) (hr error) {
|
|
| 142 |
+ if hr = procHcsCloseComputeSystem.Find(); hr != nil {
|
|
| 143 |
+ return |
|
| 144 |
+ } |
|
| 145 |
+ r0, _, _ := syscall.Syscall(procHcsCloseComputeSystem.Addr(), 1, uintptr(computeSystem), 0, 0) |
|
| 146 |
+ if int32(r0) < 0 {
|
|
| 147 |
+ if r0&0x1fff0000 == 0x00070000 {
|
|
| 148 |
+ r0 &= 0xffff |
|
| 149 |
+ } |
|
| 150 |
+ hr = syscall.Errno(r0) |
|
| 151 |
+ } |
|
| 152 |
+ return |
|
| 153 |
+} |
|
| 154 |
+ |
|
| 155 |
+func hcsStartComputeSystem(computeSystem HcsSystem, options string, result **uint16) (hr error) {
|
|
| 156 |
+ var _p0 *uint16 |
|
| 157 |
+ _p0, hr = syscall.UTF16PtrFromString(options) |
|
| 158 |
+ if hr != nil {
|
|
| 159 |
+ return |
|
| 160 |
+ } |
|
| 161 |
+ return _hcsStartComputeSystem(computeSystem, _p0, result) |
|
| 162 |
+} |
|
| 163 |
+ |
|
| 164 |
+func _hcsStartComputeSystem(computeSystem HcsSystem, options *uint16, result **uint16) (hr error) {
|
|
| 165 |
+ if hr = procHcsStartComputeSystem.Find(); hr != nil {
|
|
| 166 |
+ return |
|
| 167 |
+ } |
|
| 168 |
+ r0, _, _ := syscall.Syscall(procHcsStartComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result))) |
|
| 169 |
+ if int32(r0) < 0 {
|
|
| 170 |
+ if r0&0x1fff0000 == 0x00070000 {
|
|
| 171 |
+ r0 &= 0xffff |
|
| 172 |
+ } |
|
| 173 |
+ hr = syscall.Errno(r0) |
|
| 174 |
+ } |
|
| 175 |
+ return |
|
| 176 |
+} |
|
| 177 |
+ |
|
| 178 |
+func hcsShutdownComputeSystem(computeSystem HcsSystem, options string, result **uint16) (hr error) {
|
|
| 179 |
+ var _p0 *uint16 |
|
| 180 |
+ _p0, hr = syscall.UTF16PtrFromString(options) |
|
| 181 |
+ if hr != nil {
|
|
| 182 |
+ return |
|
| 183 |
+ } |
|
| 184 |
+ return _hcsShutdownComputeSystem(computeSystem, _p0, result) |
|
| 185 |
+} |
|
| 186 |
+ |
|
| 187 |
+func _hcsShutdownComputeSystem(computeSystem HcsSystem, options *uint16, result **uint16) (hr error) {
|
|
| 188 |
+ if hr = procHcsShutdownComputeSystem.Find(); hr != nil {
|
|
| 189 |
+ return |
|
| 190 |
+ } |
|
| 191 |
+ r0, _, _ := syscall.Syscall(procHcsShutdownComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result))) |
|
| 192 |
+ if int32(r0) < 0 {
|
|
| 193 |
+ if r0&0x1fff0000 == 0x00070000 {
|
|
| 194 |
+ r0 &= 0xffff |
|
| 195 |
+ } |
|
| 196 |
+ hr = syscall.Errno(r0) |
|
| 197 |
+ } |
|
| 198 |
+ return |
|
| 199 |
+} |
|
| 200 |
+ |
|
| 201 |
+func hcsTerminateComputeSystem(computeSystem HcsSystem, options string, result **uint16) (hr error) {
|
|
| 202 |
+ var _p0 *uint16 |
|
| 203 |
+ _p0, hr = syscall.UTF16PtrFromString(options) |
|
| 204 |
+ if hr != nil {
|
|
| 205 |
+ return |
|
| 206 |
+ } |
|
| 207 |
+ return _hcsTerminateComputeSystem(computeSystem, _p0, result) |
|
| 208 |
+} |
|
| 209 |
+ |
|
| 210 |
+func _hcsTerminateComputeSystem(computeSystem HcsSystem, options *uint16, result **uint16) (hr error) {
|
|
| 211 |
+ if hr = procHcsTerminateComputeSystem.Find(); hr != nil {
|
|
| 212 |
+ return |
|
| 213 |
+ } |
|
| 214 |
+ r0, _, _ := syscall.Syscall(procHcsTerminateComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result))) |
|
| 215 |
+ if int32(r0) < 0 {
|
|
| 216 |
+ if r0&0x1fff0000 == 0x00070000 {
|
|
| 217 |
+ r0 &= 0xffff |
|
| 218 |
+ } |
|
| 219 |
+ hr = syscall.Errno(r0) |
|
| 220 |
+ } |
|
| 221 |
+ return |
|
| 222 |
+} |
|
| 223 |
+ |
|
| 224 |
+func hcsPauseComputeSystem(computeSystem HcsSystem, options string, result **uint16) (hr error) {
|
|
| 225 |
+ var _p0 *uint16 |
|
| 226 |
+ _p0, hr = syscall.UTF16PtrFromString(options) |
|
| 227 |
+ if hr != nil {
|
|
| 228 |
+ return |
|
| 229 |
+ } |
|
| 230 |
+ return _hcsPauseComputeSystem(computeSystem, _p0, result) |
|
| 231 |
+} |
|
| 232 |
+ |
|
| 233 |
+func _hcsPauseComputeSystem(computeSystem HcsSystem, options *uint16, result **uint16) (hr error) {
|
|
| 234 |
+ if hr = procHcsPauseComputeSystem.Find(); hr != nil {
|
|
| 235 |
+ return |
|
| 236 |
+ } |
|
| 237 |
+ r0, _, _ := syscall.Syscall(procHcsPauseComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result))) |
|
| 238 |
+ if int32(r0) < 0 {
|
|
| 239 |
+ if r0&0x1fff0000 == 0x00070000 {
|
|
| 240 |
+ r0 &= 0xffff |
|
| 241 |
+ } |
|
| 242 |
+ hr = syscall.Errno(r0) |
|
| 243 |
+ } |
|
| 244 |
+ return |
|
| 245 |
+} |
|
| 246 |
+ |
|
| 247 |
+func hcsResumeComputeSystem(computeSystem HcsSystem, options string, result **uint16) (hr error) {
|
|
| 248 |
+ var _p0 *uint16 |
|
| 249 |
+ _p0, hr = syscall.UTF16PtrFromString(options) |
|
| 250 |
+ if hr != nil {
|
|
| 251 |
+ return |
|
| 252 |
+ } |
|
| 253 |
+ return _hcsResumeComputeSystem(computeSystem, _p0, result) |
|
| 254 |
+} |
|
| 255 |
+ |
|
| 256 |
+func _hcsResumeComputeSystem(computeSystem HcsSystem, options *uint16, result **uint16) (hr error) {
|
|
| 257 |
+ if hr = procHcsResumeComputeSystem.Find(); hr != nil {
|
|
| 258 |
+ return |
|
| 259 |
+ } |
|
| 260 |
+ r0, _, _ := syscall.Syscall(procHcsResumeComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result))) |
|
| 261 |
+ if int32(r0) < 0 {
|
|
| 262 |
+ if r0&0x1fff0000 == 0x00070000 {
|
|
| 263 |
+ r0 &= 0xffff |
|
| 264 |
+ } |
|
| 265 |
+ hr = syscall.Errno(r0) |
|
| 266 |
+ } |
|
| 267 |
+ return |
|
| 268 |
+} |
|
| 269 |
+ |
|
| 270 |
+func hcsGetComputeSystemProperties(computeSystem HcsSystem, propertyQuery string, properties **uint16, result **uint16) (hr error) {
|
|
| 271 |
+ var _p0 *uint16 |
|
| 272 |
+ _p0, hr = syscall.UTF16PtrFromString(propertyQuery) |
|
| 273 |
+ if hr != nil {
|
|
| 274 |
+ return |
|
| 275 |
+ } |
|
| 276 |
+ return _hcsGetComputeSystemProperties(computeSystem, _p0, properties, result) |
|
| 277 |
+} |
|
| 278 |
+ |
|
| 279 |
+func _hcsGetComputeSystemProperties(computeSystem HcsSystem, propertyQuery *uint16, properties **uint16, result **uint16) (hr error) {
|
|
| 280 |
+ if hr = procHcsGetComputeSystemProperties.Find(); hr != nil {
|
|
| 281 |
+ return |
|
| 282 |
+ } |
|
| 283 |
+ r0, _, _ := syscall.Syscall6(procHcsGetComputeSystemProperties.Addr(), 4, uintptr(computeSystem), uintptr(unsafe.Pointer(propertyQuery)), uintptr(unsafe.Pointer(properties)), uintptr(unsafe.Pointer(result)), 0, 0) |
|
| 284 |
+ if int32(r0) < 0 {
|
|
| 285 |
+ if r0&0x1fff0000 == 0x00070000 {
|
|
| 286 |
+ r0 &= 0xffff |
|
| 287 |
+ } |
|
| 288 |
+ hr = syscall.Errno(r0) |
|
| 289 |
+ } |
|
| 290 |
+ return |
|
| 291 |
+} |
|
| 292 |
+ |
|
| 293 |
+func hcsModifyComputeSystem(computeSystem HcsSystem, configuration string, result **uint16) (hr error) {
|
|
| 294 |
+ var _p0 *uint16 |
|
| 295 |
+ _p0, hr = syscall.UTF16PtrFromString(configuration) |
|
| 296 |
+ if hr != nil {
|
|
| 297 |
+ return |
|
| 298 |
+ } |
|
| 299 |
+ return _hcsModifyComputeSystem(computeSystem, _p0, result) |
|
| 300 |
+} |
|
| 301 |
+ |
|
| 302 |
+func _hcsModifyComputeSystem(computeSystem HcsSystem, configuration *uint16, result **uint16) (hr error) {
|
|
| 303 |
+ if hr = procHcsModifyComputeSystem.Find(); hr != nil {
|
|
| 304 |
+ return |
|
| 305 |
+ } |
|
| 306 |
+ r0, _, _ := syscall.Syscall(procHcsModifyComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(configuration)), uintptr(unsafe.Pointer(result))) |
|
| 307 |
+ if int32(r0) < 0 {
|
|
| 308 |
+ if r0&0x1fff0000 == 0x00070000 {
|
|
| 309 |
+ r0 &= 0xffff |
|
| 310 |
+ } |
|
| 311 |
+ hr = syscall.Errno(r0) |
|
| 312 |
+ } |
|
| 313 |
+ return |
|
| 314 |
+} |
|
| 315 |
+ |
|
| 316 |
+func hcsRegisterComputeSystemCallback(computeSystem HcsSystem, callback uintptr, context uintptr, callbackHandle *HcsCallback) (hr error) {
|
|
| 317 |
+ if hr = procHcsRegisterComputeSystemCallback.Find(); hr != nil {
|
|
| 318 |
+ return |
|
| 319 |
+ } |
|
| 320 |
+ r0, _, _ := syscall.Syscall6(procHcsRegisterComputeSystemCallback.Addr(), 4, uintptr(computeSystem), uintptr(callback), uintptr(context), uintptr(unsafe.Pointer(callbackHandle)), 0, 0) |
|
| 321 |
+ if int32(r0) < 0 {
|
|
| 322 |
+ if r0&0x1fff0000 == 0x00070000 {
|
|
| 323 |
+ r0 &= 0xffff |
|
| 324 |
+ } |
|
| 325 |
+ hr = syscall.Errno(r0) |
|
| 326 |
+ } |
|
| 327 |
+ return |
|
| 328 |
+} |
|
| 329 |
+ |
|
| 330 |
+func hcsUnregisterComputeSystemCallback(callbackHandle HcsCallback) (hr error) {
|
|
| 331 |
+ if hr = procHcsUnregisterComputeSystemCallback.Find(); hr != nil {
|
|
| 332 |
+ return |
|
| 333 |
+ } |
|
| 334 |
+ r0, _, _ := syscall.Syscall(procHcsUnregisterComputeSystemCallback.Addr(), 1, uintptr(callbackHandle), 0, 0) |
|
| 335 |
+ if int32(r0) < 0 {
|
|
| 336 |
+ if r0&0x1fff0000 == 0x00070000 {
|
|
| 337 |
+ r0 &= 0xffff |
|
| 338 |
+ } |
|
| 339 |
+ hr = syscall.Errno(r0) |
|
| 340 |
+ } |
|
| 341 |
+ return |
|
| 342 |
+} |
|
| 343 |
+ |
|
| 344 |
+func hcsCreateProcess(computeSystem HcsSystem, processParameters string, processInformation *HcsProcessInformation, process *HcsProcess, result **uint16) (hr error) {
|
|
| 345 |
+ var _p0 *uint16 |
|
| 346 |
+ _p0, hr = syscall.UTF16PtrFromString(processParameters) |
|
| 347 |
+ if hr != nil {
|
|
| 348 |
+ return |
|
| 349 |
+ } |
|
| 350 |
+ return _hcsCreateProcess(computeSystem, _p0, processInformation, process, result) |
|
| 351 |
+} |
|
| 352 |
+ |
|
| 353 |
+func _hcsCreateProcess(computeSystem HcsSystem, processParameters *uint16, processInformation *HcsProcessInformation, process *HcsProcess, result **uint16) (hr error) {
|
|
| 354 |
+ if hr = procHcsCreateProcess.Find(); hr != nil {
|
|
| 355 |
+ return |
|
| 356 |
+ } |
|
| 357 |
+ r0, _, _ := syscall.Syscall6(procHcsCreateProcess.Addr(), 5, uintptr(computeSystem), uintptr(unsafe.Pointer(processParameters)), uintptr(unsafe.Pointer(processInformation)), uintptr(unsafe.Pointer(process)), uintptr(unsafe.Pointer(result)), 0) |
|
| 358 |
+ if int32(r0) < 0 {
|
|
| 359 |
+ if r0&0x1fff0000 == 0x00070000 {
|
|
| 360 |
+ r0 &= 0xffff |
|
| 361 |
+ } |
|
| 362 |
+ hr = syscall.Errno(r0) |
|
| 363 |
+ } |
|
| 364 |
+ return |
|
| 365 |
+} |
|
| 366 |
+ |
|
| 367 |
+func hcsOpenProcess(computeSystem HcsSystem, pid uint32, process *HcsProcess, result **uint16) (hr error) {
|
|
| 368 |
+ if hr = procHcsOpenProcess.Find(); hr != nil {
|
|
| 369 |
+ return |
|
| 370 |
+ } |
|
| 371 |
+ r0, _, _ := syscall.Syscall6(procHcsOpenProcess.Addr(), 4, uintptr(computeSystem), uintptr(pid), uintptr(unsafe.Pointer(process)), uintptr(unsafe.Pointer(result)), 0, 0) |
|
| 372 |
+ if int32(r0) < 0 {
|
|
| 373 |
+ if r0&0x1fff0000 == 0x00070000 {
|
|
| 374 |
+ r0 &= 0xffff |
|
| 375 |
+ } |
|
| 376 |
+ hr = syscall.Errno(r0) |
|
| 377 |
+ } |
|
| 378 |
+ return |
|
| 379 |
+} |
|
| 380 |
+ |
|
| 381 |
+func hcsCloseProcess(process HcsProcess) (hr error) {
|
|
| 382 |
+ if hr = procHcsCloseProcess.Find(); hr != nil {
|
|
| 383 |
+ return |
|
| 384 |
+ } |
|
| 385 |
+ r0, _, _ := syscall.Syscall(procHcsCloseProcess.Addr(), 1, uintptr(process), 0, 0) |
|
| 386 |
+ if int32(r0) < 0 {
|
|
| 387 |
+ if r0&0x1fff0000 == 0x00070000 {
|
|
| 388 |
+ r0 &= 0xffff |
|
| 389 |
+ } |
|
| 390 |
+ hr = syscall.Errno(r0) |
|
| 391 |
+ } |
|
| 392 |
+ return |
|
| 393 |
+} |
|
| 394 |
+ |
|
| 395 |
+func hcsTerminateProcess(process HcsProcess, result **uint16) (hr error) {
|
|
| 396 |
+ if hr = procHcsTerminateProcess.Find(); hr != nil {
|
|
| 397 |
+ return |
|
| 398 |
+ } |
|
| 399 |
+ r0, _, _ := syscall.Syscall(procHcsTerminateProcess.Addr(), 2, uintptr(process), uintptr(unsafe.Pointer(result)), 0) |
|
| 400 |
+ if int32(r0) < 0 {
|
|
| 401 |
+ if r0&0x1fff0000 == 0x00070000 {
|
|
| 402 |
+ r0 &= 0xffff |
|
| 403 |
+ } |
|
| 404 |
+ hr = syscall.Errno(r0) |
|
| 405 |
+ } |
|
| 406 |
+ return |
|
| 407 |
+} |
|
| 408 |
+ |
|
| 409 |
+func hcsSignalProcess(process HcsProcess, options string, result **uint16) (hr error) {
|
|
| 410 |
+ var _p0 *uint16 |
|
| 411 |
+ _p0, hr = syscall.UTF16PtrFromString(options) |
|
| 412 |
+ if hr != nil {
|
|
| 413 |
+ return |
|
| 414 |
+ } |
|
| 415 |
+ return _hcsSignalProcess(process, _p0, result) |
|
| 416 |
+} |
|
| 417 |
+ |
|
| 418 |
+func _hcsSignalProcess(process HcsProcess, options *uint16, result **uint16) (hr error) {
|
|
| 419 |
+ if hr = procHcsSignalProcess.Find(); hr != nil {
|
|
| 420 |
+ return |
|
| 421 |
+ } |
|
| 422 |
+ r0, _, _ := syscall.Syscall(procHcsSignalProcess.Addr(), 3, uintptr(process), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result))) |
|
| 423 |
+ if int32(r0) < 0 {
|
|
| 424 |
+ if r0&0x1fff0000 == 0x00070000 {
|
|
| 425 |
+ r0 &= 0xffff |
|
| 426 |
+ } |
|
| 427 |
+ hr = syscall.Errno(r0) |
|
| 428 |
+ } |
|
| 429 |
+ return |
|
| 430 |
+} |
|
| 431 |
+ |
|
| 432 |
+func hcsGetProcessInfo(process HcsProcess, processInformation *HcsProcessInformation, result **uint16) (hr error) {
|
|
| 433 |
+ if hr = procHcsGetProcessInfo.Find(); hr != nil {
|
|
| 434 |
+ return |
|
| 435 |
+ } |
|
| 436 |
+ r0, _, _ := syscall.Syscall(procHcsGetProcessInfo.Addr(), 3, uintptr(process), uintptr(unsafe.Pointer(processInformation)), uintptr(unsafe.Pointer(result))) |
|
| 437 |
+ if int32(r0) < 0 {
|
|
| 438 |
+ if r0&0x1fff0000 == 0x00070000 {
|
|
| 439 |
+ r0 &= 0xffff |
|
| 440 |
+ } |
|
| 441 |
+ hr = syscall.Errno(r0) |
|
| 442 |
+ } |
|
| 443 |
+ return |
|
| 444 |
+} |
|
| 445 |
+ |
|
| 446 |
+func hcsGetProcessProperties(process HcsProcess, processProperties **uint16, result **uint16) (hr error) {
|
|
| 447 |
+ if hr = procHcsGetProcessProperties.Find(); hr != nil {
|
|
| 448 |
+ return |
|
| 449 |
+ } |
|
| 450 |
+ r0, _, _ := syscall.Syscall(procHcsGetProcessProperties.Addr(), 3, uintptr(process), uintptr(unsafe.Pointer(processProperties)), uintptr(unsafe.Pointer(result))) |
|
| 451 |
+ if int32(r0) < 0 {
|
|
| 452 |
+ if r0&0x1fff0000 == 0x00070000 {
|
|
| 453 |
+ r0 &= 0xffff |
|
| 454 |
+ } |
|
| 455 |
+ hr = syscall.Errno(r0) |
|
| 456 |
+ } |
|
| 457 |
+ return |
|
| 458 |
+} |
|
| 459 |
+ |
|
| 460 |
+func hcsModifyProcess(process HcsProcess, settings string, result **uint16) (hr error) {
|
|
| 461 |
+ var _p0 *uint16 |
|
| 462 |
+ _p0, hr = syscall.UTF16PtrFromString(settings) |
|
| 463 |
+ if hr != nil {
|
|
| 464 |
+ return |
|
| 465 |
+ } |
|
| 466 |
+ return _hcsModifyProcess(process, _p0, result) |
|
| 467 |
+} |
|
| 468 |
+ |
|
| 469 |
+func _hcsModifyProcess(process HcsProcess, settings *uint16, result **uint16) (hr error) {
|
|
| 470 |
+ if hr = procHcsModifyProcess.Find(); hr != nil {
|
|
| 471 |
+ return |
|
| 472 |
+ } |
|
| 473 |
+ r0, _, _ := syscall.Syscall(procHcsModifyProcess.Addr(), 3, uintptr(process), uintptr(unsafe.Pointer(settings)), uintptr(unsafe.Pointer(result))) |
|
| 474 |
+ if int32(r0) < 0 {
|
|
| 475 |
+ if r0&0x1fff0000 == 0x00070000 {
|
|
| 476 |
+ r0 &= 0xffff |
|
| 477 |
+ } |
|
| 478 |
+ hr = syscall.Errno(r0) |
|
| 479 |
+ } |
|
| 480 |
+ return |
|
| 481 |
+} |
|
| 482 |
+ |
|
| 483 |
+func hcsGetServiceProperties(propertyQuery string, properties **uint16, result **uint16) (hr error) {
|
|
| 484 |
+ var _p0 *uint16 |
|
| 485 |
+ _p0, hr = syscall.UTF16PtrFromString(propertyQuery) |
|
| 486 |
+ if hr != nil {
|
|
| 487 |
+ return |
|
| 488 |
+ } |
|
| 489 |
+ return _hcsGetServiceProperties(_p0, properties, result) |
|
| 490 |
+} |
|
| 491 |
+ |
|
| 492 |
+func _hcsGetServiceProperties(propertyQuery *uint16, properties **uint16, result **uint16) (hr error) {
|
|
| 493 |
+ if hr = procHcsGetServiceProperties.Find(); hr != nil {
|
|
| 494 |
+ return |
|
| 495 |
+ } |
|
| 496 |
+ r0, _, _ := syscall.Syscall(procHcsGetServiceProperties.Addr(), 3, uintptr(unsafe.Pointer(propertyQuery)), uintptr(unsafe.Pointer(properties)), uintptr(unsafe.Pointer(result))) |
|
| 497 |
+ if int32(r0) < 0 {
|
|
| 498 |
+ if r0&0x1fff0000 == 0x00070000 {
|
|
| 499 |
+ r0 &= 0xffff |
|
| 500 |
+ } |
|
| 501 |
+ hr = syscall.Errno(r0) |
|
| 502 |
+ } |
|
| 503 |
+ return |
|
| 504 |
+} |
|
| 505 |
+ |
|
| 506 |
+func hcsRegisterProcessCallback(process HcsProcess, callback uintptr, context uintptr, callbackHandle *HcsCallback) (hr error) {
|
|
| 507 |
+ if hr = procHcsRegisterProcessCallback.Find(); hr != nil {
|
|
| 508 |
+ return |
|
| 509 |
+ } |
|
| 510 |
+ r0, _, _ := syscall.Syscall6(procHcsRegisterProcessCallback.Addr(), 4, uintptr(process), uintptr(callback), uintptr(context), uintptr(unsafe.Pointer(callbackHandle)), 0, 0) |
|
| 511 |
+ if int32(r0) < 0 {
|
|
| 512 |
+ if r0&0x1fff0000 == 0x00070000 {
|
|
| 513 |
+ r0 &= 0xffff |
|
| 514 |
+ } |
|
| 515 |
+ hr = syscall.Errno(r0) |
|
| 516 |
+ } |
|
| 517 |
+ return |
|
| 518 |
+} |
|
| 519 |
+ |
|
| 520 |
+func hcsUnregisterProcessCallback(callbackHandle HcsCallback) (hr error) {
|
|
| 521 |
+ if hr = procHcsUnregisterProcessCallback.Find(); hr != nil {
|
|
| 522 |
+ return |
|
| 523 |
+ } |
|
| 524 |
+ r0, _, _ := syscall.Syscall(procHcsUnregisterProcessCallback.Addr(), 1, uintptr(callbackHandle), 0, 0) |
|
| 525 |
+ if int32(r0) < 0 {
|
|
| 526 |
+ if r0&0x1fff0000 == 0x00070000 {
|
|
| 527 |
+ r0 &= 0xffff |
|
| 528 |
+ } |
|
| 529 |
+ hr = syscall.Errno(r0) |
|
| 530 |
+ } |
|
| 531 |
+ return |
|
| 532 |
+} |
| ... | ... |
@@ -1,7 +1,13 @@ |
| 1 | 1 |
package wclayer |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "os" |
|
| 5 |
+ "path/filepath" |
|
| 6 |
+ "syscall" |
|
| 7 |
+ "unsafe" |
|
| 8 |
+ |
|
| 4 | 9 |
"github.com/Microsoft/hcsshim/internal/hcserror" |
| 10 |
+ "github.com/Microsoft/hcsshim/osversion" |
|
| 5 | 11 |
"github.com/sirupsen/logrus" |
| 6 | 12 |
) |
| 7 | 13 |
|
| ... | ... |
@@ -26,5 +32,114 @@ func ExpandScratchSize(path string, size uint64) (err error) {
|
| 26 | 26 |
if err != nil {
|
| 27 | 27 |
return hcserror.New(err, title+" - failed", "") |
| 28 | 28 |
} |
| 29 |
+ |
|
| 30 |
+ // Manually expand the volume now in order to work around bugs in 19H1 and |
|
| 31 |
+ // prerelease versions of Vb. Remove once this is fixed in Windows. |
|
| 32 |
+ if build := osversion.Get().Build; build >= osversion.V19H1 && build < 19020 {
|
|
| 33 |
+ err = expandSandboxVolume(path) |
|
| 34 |
+ if err != nil {
|
|
| 35 |
+ return err |
|
| 36 |
+ } |
|
| 37 |
+ } |
|
| 38 |
+ return nil |
|
| 39 |
+} |
|
| 40 |
+ |
|
| 41 |
+type virtualStorageType struct {
|
|
| 42 |
+ DeviceID uint32 |
|
| 43 |
+ VendorID [16]byte |
|
| 44 |
+} |
|
| 45 |
+ |
|
| 46 |
+type openVersion2 struct {
|
|
| 47 |
+ GetInfoOnly int32 // bool but 4-byte aligned |
|
| 48 |
+ ReadOnly int32 // bool but 4-byte aligned |
|
| 49 |
+ ResiliencyGUID [16]byte // GUID |
|
| 50 |
+} |
|
| 51 |
+ |
|
| 52 |
+type openVirtualDiskParameters struct {
|
|
| 53 |
+ Version uint32 // Must always be set to 2 |
|
| 54 |
+ Version2 openVersion2 |
|
| 55 |
+} |
|
| 56 |
+ |
|
| 57 |
+func attachVhd(path string) (syscall.Handle, error) {
|
|
| 58 |
+ var ( |
|
| 59 |
+ defaultType virtualStorageType |
|
| 60 |
+ handle syscall.Handle |
|
| 61 |
+ ) |
|
| 62 |
+ parameters := openVirtualDiskParameters{Version: 2}
|
|
| 63 |
+ err := openVirtualDisk( |
|
| 64 |
+ &defaultType, |
|
| 65 |
+ path, |
|
| 66 |
+ 0, |
|
| 67 |
+ 0, |
|
| 68 |
+ ¶meters, |
|
| 69 |
+ &handle) |
|
| 70 |
+ if err != nil {
|
|
| 71 |
+ return 0, &os.PathError{Op: "OpenVirtualDisk", Path: path, Err: err}
|
|
| 72 |
+ } |
|
| 73 |
+ err = attachVirtualDisk(handle, 0, 0, 0, 0, 0) |
|
| 74 |
+ if err != nil {
|
|
| 75 |
+ syscall.Close(handle) |
|
| 76 |
+ return 0, &os.PathError{Op: "AttachVirtualDisk", Path: path, Err: err}
|
|
| 77 |
+ } |
|
| 78 |
+ return handle, nil |
|
| 79 |
+} |
|
| 80 |
+ |
|
| 81 |
+func expandSandboxVolume(path string) error {
|
|
| 82 |
+ // Mount the sandbox VHD temporarily. |
|
| 83 |
+ vhdPath := filepath.Join(path, "sandbox.vhdx") |
|
| 84 |
+ vhd, err := attachVhd(vhdPath) |
|
| 85 |
+ if err != nil {
|
|
| 86 |
+ return &os.PathError{Op: "OpenVirtualDisk", Path: vhdPath, Err: err}
|
|
| 87 |
+ } |
|
| 88 |
+ defer syscall.Close(vhd) |
|
| 89 |
+ |
|
| 90 |
+ // Open the volume. |
|
| 91 |
+ volumePath, err := GetLayerMountPath(path) |
|
| 92 |
+ if err != nil {
|
|
| 93 |
+ return err |
|
| 94 |
+ } |
|
| 95 |
+ if volumePath[len(volumePath)-1] == '\\' {
|
|
| 96 |
+ volumePath = volumePath[:len(volumePath)-1] |
|
| 97 |
+ } |
|
| 98 |
+ volume, err := os.OpenFile(volumePath, os.O_RDWR, 0) |
|
| 99 |
+ if err != nil {
|
|
| 100 |
+ return err |
|
| 101 |
+ } |
|
| 102 |
+ defer volume.Close() |
|
| 103 |
+ |
|
| 104 |
+ // Get the volume's underlying partition size in NTFS clusters. |
|
| 105 |
+ var ( |
|
| 106 |
+ partitionSize int64 |
|
| 107 |
+ bytes uint32 |
|
| 108 |
+ ) |
|
| 109 |
+ const _IOCTL_DISK_GET_LENGTH_INFO = 0x0007405C |
|
| 110 |
+ err = syscall.DeviceIoControl(syscall.Handle(volume.Fd()), _IOCTL_DISK_GET_LENGTH_INFO, nil, 0, (*byte)(unsafe.Pointer(&partitionSize)), 8, &bytes, nil) |
|
| 111 |
+ if err != nil {
|
|
| 112 |
+ return &os.PathError{Op: "IOCTL_DISK_GET_LENGTH_INFO", Path: volume.Name(), Err: err}
|
|
| 113 |
+ } |
|
| 114 |
+ const ( |
|
| 115 |
+ clusterSize = 4096 |
|
| 116 |
+ sectorSize = 512 |
|
| 117 |
+ ) |
|
| 118 |
+ targetClusters := partitionSize / clusterSize |
|
| 119 |
+ |
|
| 120 |
+ // Get the volume's current size in NTFS clusters. |
|
| 121 |
+ var volumeSize int64 |
|
| 122 |
+ err = getDiskFreeSpaceEx(volume.Name()+"\\", nil, &volumeSize, nil) |
|
| 123 |
+ if err != nil {
|
|
| 124 |
+ return &os.PathError{Op: "GetDiskFreeSpaceEx", Path: volume.Name(), Err: err}
|
|
| 125 |
+ } |
|
| 126 |
+ volumeClusters := volumeSize / clusterSize |
|
| 127 |
+ |
|
| 128 |
+ // Only resize the volume if there is space to grow, otherwise this will |
|
| 129 |
+ // fail with invalid parameter. NTFS reserves one cluster. |
|
| 130 |
+ if volumeClusters+1 < targetClusters {
|
|
| 131 |
+ targetSectors := targetClusters * (clusterSize / sectorSize) |
|
| 132 |
+ const _FSCTL_EXTEND_VOLUME = 0x000900F0 |
|
| 133 |
+ err = syscall.DeviceIoControl(syscall.Handle(volume.Fd()), _FSCTL_EXTEND_VOLUME, (*byte)(unsafe.Pointer(&targetSectors)), 8, nil, 0, &bytes, nil) |
|
| 134 |
+ if err != nil {
|
|
| 135 |
+ return &os.PathError{Op: "FSCTL_EXTEND_VOLUME", Path: volume.Name(), Err: err}
|
|
| 136 |
+ } |
|
| 137 |
+ } |
|
| 29 | 138 |
return nil |
| 30 | 139 |
} |
| ... | ... |
@@ -1,6 +1,6 @@ |
| 1 | 1 |
package wclayer |
| 2 | 2 |
|
| 3 |
-import "github.com/Microsoft/hcsshim/internal/guid" |
|
| 3 |
+import "github.com/Microsoft/go-winio/pkg/guid" |
|
| 4 | 4 |
|
| 5 | 5 |
//go:generate go run ../../mksyscall_windows.go -output zsyscall_windows.go wclayer.go |
| 6 | 6 |
|
| ... | ... |
@@ -24,4 +24,9 @@ import "github.com/Microsoft/hcsshim/internal/guid" |
| 24 | 24 |
|
| 25 | 25 |
//sys grantVmAccess(vmid string, filepath string) (hr error) = vmcompute.GrantVmAccess? |
| 26 | 26 |
|
| 27 |
+//sys openVirtualDisk(virtualStorageType *virtualStorageType, path string, virtualDiskAccessMask uint32, flags uint32, parameters *openVirtualDiskParameters, handle *syscall.Handle) (err error) [failretval != 0] = virtdisk.OpenVirtualDisk |
|
| 28 |
+//sys attachVirtualDisk(handle syscall.Handle, sd uintptr, flags uint32, providerFlags uint32, params uintptr, overlapped uintptr) (err error) [failretval != 0] = virtdisk.AttachVirtualDisk |
|
| 29 |
+ |
|
| 30 |
+//sys getDiskFreeSpaceEx(directoryName string, freeBytesAvailableToCaller *int64, totalNumberOfBytes *int64, totalNumberOfFreeBytes *int64) (err error) = GetDiskFreeSpaceExW |
|
| 31 |
+ |
|
| 27 | 32 |
type _guid = guid.GUID |
| ... | ... |
@@ -38,6 +38,8 @@ func errnoErr(e syscall.Errno) error {
|
| 38 | 38 |
|
| 39 | 39 |
var ( |
| 40 | 40 |
modvmcompute = windows.NewLazySystemDLL("vmcompute.dll")
|
| 41 |
+ modvirtdisk = windows.NewLazySystemDLL("virtdisk.dll")
|
|
| 42 |
+ modkernel32 = windows.NewLazySystemDLL("kernel32.dll")
|
|
| 41 | 43 |
|
| 42 | 44 |
procActivateLayer = modvmcompute.NewProc("ActivateLayer")
|
| 43 | 45 |
procCopyLayer = modvmcompute.NewProc("CopyLayer")
|
| ... | ... |
@@ -57,6 +59,9 @@ var ( |
| 57 | 57 |
procProcessBaseImage = modvmcompute.NewProc("ProcessBaseImage")
|
| 58 | 58 |
procProcessUtilityImage = modvmcompute.NewProc("ProcessUtilityImage")
|
| 59 | 59 |
procGrantVmAccess = modvmcompute.NewProc("GrantVmAccess")
|
| 60 |
+ procOpenVirtualDisk = modvirtdisk.NewProc("OpenVirtualDisk")
|
|
| 61 |
+ procAttachVirtualDisk = modvirtdisk.NewProc("AttachVirtualDisk")
|
|
| 62 |
+ procGetDiskFreeSpaceExW = modkernel32.NewProc("GetDiskFreeSpaceExW")
|
|
| 60 | 63 |
) |
| 61 | 64 |
|
| 62 | 65 |
func activateLayer(info *driverInfo, id string) (hr error) {
|
| ... | ... |
@@ -508,3 +513,57 @@ func _grantVmAccess(vmid *uint16, filepath *uint16) (hr error) {
|
| 508 | 508 |
} |
| 509 | 509 |
return |
| 510 | 510 |
} |
| 511 |
+ |
|
| 512 |
+func openVirtualDisk(virtualStorageType *virtualStorageType, path string, virtualDiskAccessMask uint32, flags uint32, parameters *openVirtualDiskParameters, handle *syscall.Handle) (err error) {
|
|
| 513 |
+ var _p0 *uint16 |
|
| 514 |
+ _p0, err = syscall.UTF16PtrFromString(path) |
|
| 515 |
+ if err != nil {
|
|
| 516 |
+ return |
|
| 517 |
+ } |
|
| 518 |
+ return _openVirtualDisk(virtualStorageType, _p0, virtualDiskAccessMask, flags, parameters, handle) |
|
| 519 |
+} |
|
| 520 |
+ |
|
| 521 |
+func _openVirtualDisk(virtualStorageType *virtualStorageType, path *uint16, virtualDiskAccessMask uint32, flags uint32, parameters *openVirtualDiskParameters, handle *syscall.Handle) (err error) {
|
|
| 522 |
+ r1, _, e1 := syscall.Syscall6(procOpenVirtualDisk.Addr(), 6, uintptr(unsafe.Pointer(virtualStorageType)), uintptr(unsafe.Pointer(path)), uintptr(virtualDiskAccessMask), uintptr(flags), uintptr(unsafe.Pointer(parameters)), uintptr(unsafe.Pointer(handle))) |
|
| 523 |
+ if r1 != 0 {
|
|
| 524 |
+ if e1 != 0 {
|
|
| 525 |
+ err = errnoErr(e1) |
|
| 526 |
+ } else {
|
|
| 527 |
+ err = syscall.EINVAL |
|
| 528 |
+ } |
|
| 529 |
+ } |
|
| 530 |
+ return |
|
| 531 |
+} |
|
| 532 |
+ |
|
| 533 |
+func attachVirtualDisk(handle syscall.Handle, sd uintptr, flags uint32, providerFlags uint32, params uintptr, overlapped uintptr) (err error) {
|
|
| 534 |
+ r1, _, e1 := syscall.Syscall6(procAttachVirtualDisk.Addr(), 6, uintptr(handle), uintptr(sd), uintptr(flags), uintptr(providerFlags), uintptr(params), uintptr(overlapped)) |
|
| 535 |
+ if r1 != 0 {
|
|
| 536 |
+ if e1 != 0 {
|
|
| 537 |
+ err = errnoErr(e1) |
|
| 538 |
+ } else {
|
|
| 539 |
+ err = syscall.EINVAL |
|
| 540 |
+ } |
|
| 541 |
+ } |
|
| 542 |
+ return |
|
| 543 |
+} |
|
| 544 |
+ |
|
| 545 |
+func getDiskFreeSpaceEx(directoryName string, freeBytesAvailableToCaller *int64, totalNumberOfBytes *int64, totalNumberOfFreeBytes *int64) (err error) {
|
|
| 546 |
+ var _p0 *uint16 |
|
| 547 |
+ _p0, err = syscall.UTF16PtrFromString(directoryName) |
|
| 548 |
+ if err != nil {
|
|
| 549 |
+ return |
|
| 550 |
+ } |
|
| 551 |
+ return _getDiskFreeSpaceEx(_p0, freeBytesAvailableToCaller, totalNumberOfBytes, totalNumberOfFreeBytes) |
|
| 552 |
+} |
|
| 553 |
+ |
|
| 554 |
+func _getDiskFreeSpaceEx(directoryName *uint16, freeBytesAvailableToCaller *int64, totalNumberOfBytes *int64, totalNumberOfFreeBytes *int64) (err error) {
|
|
| 555 |
+ r1, _, e1 := syscall.Syscall6(procGetDiskFreeSpaceExW.Addr(), 4, uintptr(unsafe.Pointer(directoryName)), uintptr(unsafe.Pointer(freeBytesAvailableToCaller)), uintptr(unsafe.Pointer(totalNumberOfBytes)), uintptr(unsafe.Pointer(totalNumberOfFreeBytes)), 0, 0) |
|
| 556 |
+ if r1 == 0 {
|
|
| 557 |
+ if e1 != 0 {
|
|
| 558 |
+ err = errnoErr(e1) |
|
| 559 |
+ } else {
|
|
| 560 |
+ err = syscall.EINVAL |
|
| 561 |
+ } |
|
| 562 |
+ } |
|
| 563 |
+ return |
|
| 564 |
+} |
| ... | ... |
@@ -4,7 +4,7 @@ import ( |
| 4 | 4 |
"crypto/sha1" |
| 5 | 5 |
"path/filepath" |
| 6 | 6 |
|
| 7 |
- "github.com/Microsoft/hcsshim/internal/guid" |
|
| 7 |
+ "github.com/Microsoft/go-winio/pkg/guid" |
|
| 8 | 8 |
"github.com/Microsoft/hcsshim/internal/wclayer" |
| 9 | 9 |
) |
| 10 | 10 |
|
| ... | ... |
@@ -77,7 +77,7 @@ type GUID [16]byte |
| 77 | 77 |
|
| 78 | 78 |
func NameToGuid(name string) (id GUID, err error) {
|
| 79 | 79 |
g, err := wclayer.NameToGuid(name) |
| 80 |
- return GUID(g), err |
|
| 80 |
+ return g.ToWindowsArray(), err |
|
| 81 | 81 |
} |
| 82 | 82 |
|
| 83 | 83 |
func NewGUID(source string) *GUID {
|
| ... | ... |
@@ -88,7 +88,7 @@ func NewGUID(source string) *GUID {
|
| 88 | 88 |
} |
| 89 | 89 |
|
| 90 | 90 |
func (g *GUID) ToString() string {
|
| 91 |
- return (guid.GUID)(*g).String() |
|
| 91 |
+ return guid.FromWindowsArray(*g).String() |
|
| 92 | 92 |
} |
| 93 | 93 |
|
| 94 | 94 |
type LayerReader = wclayer.LayerReader |
| ... | ... |
@@ -14,10 +14,14 @@ const ( |
| 14 | 14 |
RS3 = 16299 |
| 15 | 15 |
|
| 16 | 16 |
// RS4 (version 1803, codename "Redstone 4") corresponds to Windows Server |
| 17 |
- // 1809 (Semi-Annual Channel (SAC)), and Windows 10 (April 2018 Update). |
|
| 17 |
+ // 1803 (Semi-Annual Channel (SAC)), and Windows 10 (April 2018 Update). |
|
| 18 | 18 |
RS4 = 17134 |
| 19 | 19 |
|
| 20 | 20 |
// RS5 (version 1809, codename "Redstone 5") corresponds to Windows Server |
| 21 | 21 |
// 2019 (ltsc2019), and Windows 10 (October 2018 Update). |
| 22 | 22 |
RS5 = 17763 |
| 23 |
+ |
|
| 24 |
+ // V19H1 (version 1903) corresponds to Windows Server 1903 (semi-annual |
|
| 25 |
+ // channel). |
|
| 26 |
+ V19H1 = 18362 |
|
| 23 | 27 |
) |
| ... | ... |
@@ -1,7 +1,9 @@ |
| 1 | 1 |
package hcsshim |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "context" |
|
| 4 | 5 |
"io" |
| 6 |
+ "sync" |
|
| 5 | 7 |
"time" |
| 6 | 8 |
|
| 7 | 9 |
"github.com/Microsoft/hcsshim/internal/hcs" |
| ... | ... |
@@ -9,7 +11,10 @@ import ( |
| 9 | 9 |
|
| 10 | 10 |
// ContainerError is an error encountered in HCS |
| 11 | 11 |
type process struct {
|
| 12 |
- p *hcs.Process |
|
| 12 |
+ p *hcs.Process |
|
| 13 |
+ waitOnce sync.Once |
|
| 14 |
+ waitCh chan struct{}
|
|
| 15 |
+ waitErr error |
|
| 13 | 16 |
} |
| 14 | 17 |
|
| 15 | 18 |
// Pid returns the process ID of the process within the container. |
| ... | ... |
@@ -19,7 +24,14 @@ func (process *process) Pid() int {
|
| 19 | 19 |
|
| 20 | 20 |
// Kill signals the process to terminate but does not wait for it to finish terminating. |
| 21 | 21 |
func (process *process) Kill() error {
|
| 22 |
- return convertProcessError(process.p.Kill(), process) |
|
| 22 |
+ found, err := process.p.Kill(context.Background()) |
|
| 23 |
+ if err != nil {
|
|
| 24 |
+ return convertProcessError(err, process) |
|
| 25 |
+ } |
|
| 26 |
+ if !found {
|
|
| 27 |
+ return &ProcessError{Process: process, Err: ErrElementNotFound, Operation: "hcsshim::Process::Kill"}
|
|
| 28 |
+ } |
|
| 29 |
+ return nil |
|
| 23 | 30 |
} |
| 24 | 31 |
|
| 25 | 32 |
// Wait waits for the process to exit. |
| ... | ... |
@@ -30,7 +42,21 @@ func (process *process) Wait() error {
|
| 30 | 30 |
// WaitTimeout waits for the process to exit or the duration to elapse. It returns |
| 31 | 31 |
// false if timeout occurs. |
| 32 | 32 |
func (process *process) WaitTimeout(timeout time.Duration) error {
|
| 33 |
- return convertProcessError(process.p.WaitTimeout(timeout), process) |
|
| 33 |
+ process.waitOnce.Do(func() {
|
|
| 34 |
+ process.waitCh = make(chan struct{})
|
|
| 35 |
+ go func() {
|
|
| 36 |
+ process.waitErr = process.Wait() |
|
| 37 |
+ close(process.waitCh) |
|
| 38 |
+ }() |
|
| 39 |
+ }) |
|
| 40 |
+ t := time.NewTimer(timeout) |
|
| 41 |
+ defer t.Stop() |
|
| 42 |
+ select {
|
|
| 43 |
+ case <-t.C: |
|
| 44 |
+ return &ProcessError{Process: process, Err: ErrTimeout, Operation: "hcsshim::Process::Wait"}
|
|
| 45 |
+ case <-process.waitCh: |
|
| 46 |
+ return process.waitErr |
|
| 47 |
+ } |
|
| 34 | 48 |
} |
| 35 | 49 |
|
| 36 | 50 |
// ExitCode returns the exit code of the process. The process must have |
| ... | ... |
@@ -45,14 +71,14 @@ func (process *process) ExitCode() (int, error) {
|
| 45 | 45 |
|
| 46 | 46 |
// ResizeConsole resizes the console of the process. |
| 47 | 47 |
func (process *process) ResizeConsole(width, height uint16) error {
|
| 48 |
- return convertProcessError(process.p.ResizeConsole(width, height), process) |
|
| 48 |
+ return convertProcessError(process.p.ResizeConsole(context.Background(), width, height), process) |
|
| 49 | 49 |
} |
| 50 | 50 |
|
| 51 | 51 |
// Stdio returns the stdin, stdout, and stderr pipes, respectively. Closing |
| 52 | 52 |
// these pipes does not close the underlying pipes; it should be possible to |
| 53 | 53 |
// call this multiple times to get multiple interfaces. |
| 54 | 54 |
func (process *process) Stdio() (io.WriteCloser, io.ReadCloser, io.ReadCloser, error) {
|
| 55 |
- stdin, stdout, stderr, err := process.p.Stdio() |
|
| 55 |
+ stdin, stdout, stderr, err := process.p.StdioLegacy() |
|
| 56 | 56 |
if err != nil {
|
| 57 | 57 |
err = convertProcessError(err, process) |
| 58 | 58 |
} |
| ... | ... |
@@ -62,7 +88,7 @@ func (process *process) Stdio() (io.WriteCloser, io.ReadCloser, io.ReadCloser, e |
| 62 | 62 |
// CloseStdin closes the write side of the stdin pipe so that the process is |
| 63 | 63 |
// notified on the read side that there is no more data in stdin. |
| 64 | 64 |
func (process *process) CloseStdin() error {
|
| 65 |
- return convertProcessError(process.p.CloseStdin(), process) |
|
| 65 |
+ return convertProcessError(process.p.CloseStdin(context.Background()), process) |
|
| 66 | 66 |
} |
| 67 | 67 |
|
| 68 | 68 |
// Close cleans up any state associated with the process but does not kill |
| 69 | 69 |
deleted file mode 100644 |
| ... | ... |
@@ -1,33 +0,0 @@ |
| 1 |
-github.com/blang/semver v3.1.0 |
|
| 2 |
-github.com/containerd/console c12b1e7919c14469339a5d38f2f8ed9b64a9de23 |
|
| 3 |
-github.com/containerd/containerd faec567304bbdf6864b1663d4f813641b5880a4a |
|
| 4 |
-github.com/containerd/go-runc 5a6d9f37cfa36b15efba46dc7ea349fa9b7143c3 |
|
| 5 |
-github.com/containerd/ttrpc 2a805f71863501300ae1976d29f0454ae003e85a |
|
| 6 |
-github.com/containerd/typeurl a93fcdb778cd272c6e9b3028b2f42d813e785d40 |
|
| 7 |
-github.com/gogo/protobuf v1.0.0 |
|
| 8 |
-github.com/golang/protobuf v1.1.0 |
|
| 9 |
-github.com/hashicorp/errwrap 7554cd9344cec97297fa6649b055a8c98c2a1e55 |
|
| 10 |
-github.com/hashicorp/go-multierror ed905158d87462226a13fe39ddf685ea65f1c11f |
|
| 11 |
-github.com/konsorten/go-windows-terminal-sequences v1.0.1 |
|
| 12 |
-github.com/linuxkit/virtsock 8e79449dea0735c1c056d814934dd035734cc97c |
|
| 13 |
-github.com/Microsoft/go-winio 84b4ab48a50763fe7b3abcef38e5205c12027fac |
|
| 14 |
-github.com/Microsoft/opengcs v0.3.9 |
|
| 15 |
-github.com/opencontainers/go-digest c9281466c8b2f606084ac71339773efd177436e7 |
|
| 16 |
-github.com/opencontainers/runc 12f6a991201fdb8f82579582d5e00e28fba06d0a |
|
| 17 |
-github.com/opencontainers/runtime-spec 29686dbc5559d93fb1ef402eeda3e35c38d75af4 |
|
| 18 |
-github.com/opencontainers/runtime-tools 1d69bd0f9c39677d0630e50664fbc3154ae61b88 |
|
| 19 |
-github.com/pkg/errors v0.8.1 |
|
| 20 |
-github.com/sirupsen/logrus v1.3.0 |
|
| 21 |
-github.com/syndtr/gocapability db04d3cc01c8b54962a58ec7e491717d06cfcc16 |
|
| 22 |
-github.com/urfave/cli 7bc6a0acffa589f415f88aca16cc1de5ffd66f9c |
|
| 23 |
-github.com/xeipuuv/gojsonpointer 4e3ac2762d5f479393488629ee9370b50873b3a6 |
|
| 24 |
-github.com/xeipuuv/gojsonreference bd5ef7bd5415a7ac448318e64f11a24cd21e594b |
|
| 25 |
-github.com/xeipuuv/gojsonschema 1d523034197ff1f222f6429836dd36a2457a1874 |
|
| 26 |
-golang.org/x/crypto ff983b9c42bc9fbf91556e191cc8efb585c16908 |
|
| 27 |
-golang.org/x/net ed066c81e75eba56dd9bd2139ade88125b855585 |
|
| 28 |
-golang.org/x/sync 37e7f081c4d4c64e13b10787722085407fe5d15f |
|
| 29 |
-golang.org/x/sys e5ecc2a6747ce8d4af18ed98b3de5ae30eb3a5bb |
|
| 30 |
-golang.org/x/text d14c52b222ee852cdba8b07206ca0c614b389876 |
|
| 31 |
-google.golang.org/genproto d80a6e20e776b0b17a324d0ba1ab50a39c8e8944 |
|
| 32 |
-google.golang.org/grpc v1.12.0 |
|
| 33 |
-k8s.io/kubernetes v1.13.0 |