vendor: update to latest hcsshim - 0.8.9
Switch to a tagged version of hcsshim. Context here: https://github.com/kubernetes/kubernetes/issues/87420#issuecomment-620837610 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
cdac4dece4
commit
fae2a4b052
@ -32,7 +32,7 @@ github.com/imdario/mergo 7c29201646fa3de8506f70121347
|
|||||||
github.com/konsorten/go-windows-terminal-sequences edb144dfd453055e1e49a3d8b410a660b5a87613 # v1.0.3
|
github.com/konsorten/go-windows-terminal-sequences edb144dfd453055e1e49a3d8b410a660b5a87613 # v1.0.3
|
||||||
github.com/matttproud/golang_protobuf_extensions c12348ce28de40eed0136aa2b644d0ee0650e56c # v1.0.1
|
github.com/matttproud/golang_protobuf_extensions c12348ce28de40eed0136aa2b644d0ee0650e56c # v1.0.1
|
||||||
github.com/Microsoft/go-winio 6c72808b55902eae4c5943626030429ff20f3b63 # v0.4.14
|
github.com/Microsoft/go-winio 6c72808b55902eae4c5943626030429ff20f3b63 # v0.4.14
|
||||||
github.com/Microsoft/hcsshim 0b571ac85d7c5842b26d2571de4868634a4c39d7 # v0.8.7-24-g0b571ac8
|
github.com/Microsoft/hcsshim 5bc557dd210ff2caf615e6e22d398123de77fc11 # v0.8.9
|
||||||
github.com/opencontainers/go-digest c9281466c8b2f606084ac71339773efd177436e7
|
github.com/opencontainers/go-digest c9281466c8b2f606084ac71339773efd177436e7
|
||||||
github.com/opencontainers/image-spec d60099175f88c47cd379c4738d158884749ed235 # v1.0.1
|
github.com/opencontainers/image-spec d60099175f88c47cd379c4738d158884749ed235 # v1.0.1
|
||||||
github.com/opencontainers/runc dc9208a3303feef5b3839f4323d9beb36df0a9dd # v1.0.0-rc10
|
github.com/opencontainers/runc dc9208a3303feef5b3839f4323d9beb36df0a9dd # v1.0.0-rc10
|
||||||
|
5
vendor/github.com/Microsoft/hcsshim/README.md
generated
vendored
5
vendor/github.com/Microsoft/hcsshim/README.md
generated
vendored
@ -16,6 +16,11 @@ When you submit a pull request, a CLA-bot will automatically determine whether y
|
|||||||
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
|
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
|
||||||
provided by the bot. You will only need to do this once across all repos using our CLA.
|
provided by the bot. You will only need to do this once across all repos using our CLA.
|
||||||
|
|
||||||
|
We also ask that contributors [sign their commits](https://git-scm.com/docs/git-commit) using `git commit -s` or `git commit --signoff` to certify they either authored the work themselves or otherwise have permission to use it in this project.
|
||||||
|
|
||||||
|
|
||||||
|
## Code of Conduct
|
||||||
|
|
||||||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
||||||
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
|
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
|
||||||
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
||||||
|
147
vendor/github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options/runhcs.pb.go
generated
vendored
147
vendor/github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options/runhcs.pb.go
generated
vendored
@ -112,7 +112,10 @@ type Options struct {
|
|||||||
// hypervisor isolated utility vm.
|
// hypervisor isolated utility vm.
|
||||||
//
|
//
|
||||||
// The platform default is 1024MB if omitted.
|
// The platform default is 1024MB if omitted.
|
||||||
VmMemorySizeInMb int32 `protobuf:"varint,9,opt,name=vm_memory_size_in_mb,json=vmMemorySizeInMb,proto3" json:"vm_memory_size_in_mb,omitempty"`
|
VmMemorySizeInMb int32 `protobuf:"varint,9,opt,name=vm_memory_size_in_mb,json=vmMemorySizeInMb,proto3" json:"vm_memory_size_in_mb,omitempty"`
|
||||||
|
// GPUVHDPath is the path to the gpu vhd to add to the uvm
|
||||||
|
// when a container requests a gpu
|
||||||
|
GPUVHDPath string `protobuf:"bytes,10,opt,name=GPUVHDPath,json=gPUVHDPath,proto3" json:"GPUVHDPath,omitempty"`
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
XXX_sizecache int32 `json:"-"`
|
XXX_sizecache int32 `json:"-"`
|
||||||
@ -211,55 +214,56 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var fileDescriptor_b643df6839c75082 = []byte{
|
var fileDescriptor_b643df6839c75082 = []byte{
|
||||||
// 760 bytes of a gzipped FileDescriptorProto
|
// 777 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xcb, 0x6e, 0xdb, 0x46,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xcd, 0x6f, 0xdb, 0x36,
|
||||||
0x14, 0x15, 0x63, 0xbd, 0x78, 0x53, 0x3b, 0xf4, 0x54, 0x0b, 0xc2, 0x6d, 0x25, 0xc1, 0x59, 0xc4,
|
0x1c, 0xb5, 0x9a, 0xf8, 0x43, 0xbf, 0x2e, 0xa9, 0xc2, 0xf9, 0x20, 0x64, 0x9b, 0x6d, 0xa4, 0x87,
|
||||||
0x41, 0x63, 0xd2, 0x4e, 0x97, 0x5d, 0x55, 0x96, 0x8c, 0xb2, 0xa8, 0x6d, 0x82, 0x32, 0x9a, 0x3e,
|
0xa6, 0x58, 0x23, 0x25, 0xdd, 0x71, 0xa7, 0x39, 0x76, 0x56, 0x0d, 0x4b, 0x22, 0xc8, 0x59, 0xbb,
|
||||||
0x16, 0x03, 0x3e, 0xc6, 0xd4, 0x20, 0x1a, 0x0e, 0x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, 0x85, 0x44, 0x9f,
|
||||||
0x01, 0xa4, 0x82, 0xc4, 0x8a, 0x64, 0x38, 0x56, 0x26, 0x36, 0x8f, 0x5f, 0x1e, 0x78, 0x55, 0x1c,
|
0x01, 0x98, 0x27, 0xc4, 0x45, 0xcc, 0x88, 0x89, 0x94, 0x1d, 0xd9, 0x06, 0xb9, 0x88, 0x19, 0x41,
|
||||||
0xbd, 0x26, 0x8e, 0xde, 0x75, 0x13, 0xc7, 0x49, 0xff, 0xee, 0x7e, 0xd4, 0xfa, 0xf5, 0xaf, 0x91,
|
0xa7, 0x00, 0xa9, 0x20, 0xb1, 0x22, 0x19, 0x8e, 0x95, 0x89, 0xd5, 0xc3, 0xe7, 0xfb, 0x5e, 0x15,
|
||||||
0x15, 0xd9, 0xf5, 0xbd, 0xaf, 0x14, 0xfa, 0x1c, 0xd0, 0x6b, 0x22, 0x0a, 0xb2, 0xc4, 0x3a, 0xb7,
|
0x57, 0xaf, 0x89, 0xab, 0x77, 0xd5, 0xc4, 0x75, 0xdc, 0xbb, 0xbd, 0x1b, 0xb6, 0x7e, 0xfd, 0x6b,
|
||||||
0xf8, 0xf4, 0xe4, 0x04, 0x17, 0xd2, 0x04, 0xa7, 0x1d, 0x3d, 0xa9, 0x18, 0xed, 0x70, 0x7a, 0x72,
|
0x68, 0x45, 0x76, 0x7d, 0xef, 0x2b, 0x85, 0x3e, 0x07, 0xf4, 0x9a, 0x88, 0x82, 0x2c, 0xb0, 0xce,
|
||||||
0x72, 0x29, 0x91, 0x07, 0x1f, 0xd7, 0xcb, 0x4a, 0x39, 0x63, 0x54, 0xe1, 0x64, 0xa3, 0x88, 0x34,
|
0x35, 0x3e, 0x39, 0x3e, 0xc6, 0x85, 0x34, 0xc1, 0xda, 0x8e, 0x1e, 0x55, 0x8c, 0x76, 0x38, 0x39,
|
||||||
0x09, 0x6a, 0x47, 0xfb, 0x15, 0x75, 0x66, 0x98, 0x89, 0x26, 0xd0, 0x39, 0x8c, 0x6b, 0xf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, 0x74, 0xcc, 0xbb, 0x7f, 0xf1, 0x4f, 0x00, 0x00, 0x00, 0xff,
|
||||||
|
0xff, 0xc9, 0xeb, 0xae, 0x6f, 0x33, 0x05, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Options) Marshal() (dAtA []byte, err error) {
|
func (m *Options) Marshal() (dAtA []byte, err error) {
|
||||||
@ -331,6 +335,12 @@ func (m *Options) MarshalTo(dAtA []byte) (int, error) {
|
|||||||
i++
|
i++
|
||||||
i = encodeVarintRunhcs(dAtA, i, uint64(m.VmMemorySizeInMb))
|
i = encodeVarintRunhcs(dAtA, i, uint64(m.VmMemorySizeInMb))
|
||||||
}
|
}
|
||||||
|
if len(m.GPUVHDPath) > 0 {
|
||||||
|
dAtA[i] = 0x52
|
||||||
|
i++
|
||||||
|
i = encodeVarintRunhcs(dAtA, i, uint64(len(m.GPUVHDPath)))
|
||||||
|
i += copy(dAtA[i:], m.GPUVHDPath)
|
||||||
|
}
|
||||||
if m.XXX_unrecognized != nil {
|
if m.XXX_unrecognized != nil {
|
||||||
i += copy(dAtA[i:], m.XXX_unrecognized)
|
i += copy(dAtA[i:], m.XXX_unrecognized)
|
||||||
}
|
}
|
||||||
@ -454,6 +464,10 @@ func (m *Options) Size() (n int) {
|
|||||||
if m.VmMemorySizeInMb != 0 {
|
if m.VmMemorySizeInMb != 0 {
|
||||||
n += 1 + sovRunhcs(uint64(m.VmMemorySizeInMb))
|
n += 1 + sovRunhcs(uint64(m.VmMemorySizeInMb))
|
||||||
}
|
}
|
||||||
|
l = len(m.GPUVHDPath)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovRunhcs(uint64(l))
|
||||||
|
}
|
||||||
if m.XXX_unrecognized != nil {
|
if m.XXX_unrecognized != nil {
|
||||||
n += len(m.XXX_unrecognized)
|
n += len(m.XXX_unrecognized)
|
||||||
}
|
}
|
||||||
@ -527,6 +541,7 @@ func (this *Options) String() string {
|
|||||||
`BootFilesRootPath:` + fmt.Sprintf("%v", this.BootFilesRootPath) + `,`,
|
`BootFilesRootPath:` + fmt.Sprintf("%v", this.BootFilesRootPath) + `,`,
|
||||||
`VmProcessorCount:` + fmt.Sprintf("%v", this.VmProcessorCount) + `,`,
|
`VmProcessorCount:` + fmt.Sprintf("%v", this.VmProcessorCount) + `,`,
|
||||||
`VmMemorySizeInMb:` + fmt.Sprintf("%v", this.VmMemorySizeInMb) + `,`,
|
`VmMemorySizeInMb:` + fmt.Sprintf("%v", this.VmMemorySizeInMb) + `,`,
|
||||||
|
`GPUVHDPath:` + fmt.Sprintf("%v", this.GPUVHDPath) + `,`,
|
||||||
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
|
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
|
||||||
`}`,
|
`}`,
|
||||||
}, "")
|
}, "")
|
||||||
@ -812,6 +827,38 @@ func (m *Options) Unmarshal(dAtA []byte) error {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case 10:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field GPUVHDPath", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowRunhcs
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthRunhcs
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthRunhcs
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.GPUVHDPath = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
skippy, err := skipRunhcs(dAtA[iNdEx:])
|
skippy, err := skipRunhcs(dAtA[iNdEx:])
|
||||||
|
@ -59,6 +59,10 @@ message Options {
|
|||||||
//
|
//
|
||||||
// The platform default is 1024MB if omitted.
|
// The platform default is 1024MB if omitted.
|
||||||
int32 vm_memory_size_in_mb = 9;
|
int32 vm_memory_size_in_mb = 9;
|
||||||
|
|
||||||
|
// GPUVHDPath is the path to the gpu vhd to add to the uvm
|
||||||
|
// when a container requests a gpu
|
||||||
|
string GPUVHDPath = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProcessDetails contains additional information about a process. This is the additional
|
// ProcessDetails contains additional information about a process. This is the additional
|
||||||
|
28
vendor/github.com/Microsoft/hcsshim/go.mod
generated
vendored
28
vendor/github.com/Microsoft/hcsshim/go.mod
generated
vendored
@ -4,34 +4,32 @@ go 1.13
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5
|
github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5
|
||||||
github.com/blang/semver v3.1.0+incompatible // indirect
|
|
||||||
github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f
|
github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f
|
||||||
github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1
|
github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1
|
||||||
github.com/containerd/containerd v1.3.0-beta.2.0.20190828155532-0293cbd26c69
|
github.com/containerd/containerd v1.3.2
|
||||||
github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc // indirect
|
github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc // indirect
|
||||||
github.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448 // indirect
|
github.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448 // indirect
|
||||||
github.com/containerd/go-runc v0.0.0-20180907222934-5a6d9f37cfa3
|
github.com/containerd/go-runc v0.0.0-20180907222934-5a6d9f37cfa3
|
||||||
github.com/containerd/ttrpc v0.0.0-20190828154514-0e0f228740de
|
github.com/containerd/ttrpc v0.0.0-20190828154514-0e0f228740de
|
||||||
github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd
|
github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd
|
||||||
github.com/gogo/protobuf v1.2.1
|
github.com/gogo/protobuf v1.3.1
|
||||||
github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce // indirect
|
github.com/golang/protobuf v1.3.2 // indirect
|
||||||
github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874 // indirect
|
github.com/kr/pretty v0.1.0 // indirect
|
||||||
github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2 // indirect
|
github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2 // indirect
|
||||||
github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f // indirect
|
github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f // indirect
|
||||||
github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700
|
github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700
|
||||||
github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39
|
|
||||||
github.com/pkg/errors v0.8.1
|
github.com/pkg/errors v0.8.1
|
||||||
github.com/prometheus/procfs v0.0.5 // indirect
|
github.com/prometheus/procfs v0.0.0-20180125133057-cb4147076ac7 // indirect
|
||||||
github.com/sirupsen/logrus v1.4.1
|
github.com/sirupsen/logrus v1.4.2
|
||||||
github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8 // indirect
|
github.com/stretchr/testify v1.4.0 // indirect
|
||||||
github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5
|
github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5
|
||||||
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
|
|
||||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
|
|
||||||
github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f // indirect
|
|
||||||
go.opencensus.io v0.22.0
|
go.opencensus.io v0.22.0
|
||||||
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6
|
golang.org/x/net v0.0.0-20191004110552-13f9640d40b9 // indirect
|
||||||
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58
|
||||||
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3
|
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3
|
||||||
google.golang.org/grpc v1.20.1
|
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873 // indirect
|
||||||
|
google.golang.org/grpc v1.23.1
|
||||||
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
|
||||||
|
gopkg.in/yaml.v2 v2.2.8 // indirect
|
||||||
gotest.tools v2.2.0+incompatible // indirect
|
gotest.tools v2.2.0+incompatible // indirect
|
||||||
k8s.io/kubernetes v1.13.0
|
|
||||||
)
|
)
|
||||||
|
19
vendor/github.com/Microsoft/hcsshim/hcn/hcn.go
generated
vendored
19
vendor/github.com/Microsoft/hcsshim/hcn/hcn.go
generated
vendored
@ -55,6 +55,15 @@ import (
|
|||||||
//sys hcnDeleteLoadBalancer(id *_guid, result **uint16) (hr error) = computenetwork.HcnDeleteLoadBalancer?
|
//sys hcnDeleteLoadBalancer(id *_guid, result **uint16) (hr error) = computenetwork.HcnDeleteLoadBalancer?
|
||||||
//sys hcnCloseLoadBalancer(loadBalancer hcnLoadBalancer) (hr error) = computenetwork.HcnCloseLoadBalancer?
|
//sys hcnCloseLoadBalancer(loadBalancer hcnLoadBalancer) (hr error) = computenetwork.HcnCloseLoadBalancer?
|
||||||
|
|
||||||
|
// SDN Routes
|
||||||
|
//sys hcnEnumerateRoutes(query string, routes **uint16, result **uint16) (hr error) = computenetwork.HcnEnumerateSdnRoutes?
|
||||||
|
//sys hcnCreateRoute(id *_guid, settings string, route *hcnRoute, result **uint16) (hr error) = computenetwork.HcnCreateSdnRoute?
|
||||||
|
//sys hcnOpenRoute(id *_guid, route *hcnRoute, result **uint16) (hr error) = computenetwork.HcnOpenSdnRoute?
|
||||||
|
//sys hcnModifyRoute(route hcnRoute, settings string, result **uint16) (hr error) = computenetwork.HcnModifySdnRoute?
|
||||||
|
//sys hcnQueryRouteProperties(route hcnRoute, query string, properties **uint16, result **uint16) (hr error) = computenetwork.HcnQuerySdnRouteProperties?
|
||||||
|
//sys hcnDeleteRoute(id *_guid, result **uint16) (hr error) = computenetwork.HcnDeleteSdnRoute?
|
||||||
|
//sys hcnCloseRoute(route hcnRoute) (hr error) = computenetwork.HcnCloseSdnRoute?
|
||||||
|
|
||||||
// Service
|
// Service
|
||||||
//sys hcnOpenService(service *hcnService, result **uint16) (hr error) = computenetwork.HcnOpenService?
|
//sys hcnOpenService(service *hcnService, result **uint16) (hr error) = computenetwork.HcnOpenService?
|
||||||
//sys hcnRegisterServiceCallback(service hcnService, callback int32, context int32, callbackHandle *hcnCallbackHandle) (hr error) = computenetwork.HcnRegisterServiceCallback?
|
//sys hcnRegisterServiceCallback(service hcnService, callback int32, context int32, callbackHandle *hcnCallbackHandle) (hr error) = computenetwork.HcnRegisterServiceCallback?
|
||||||
@ -67,6 +76,7 @@ type hcnNetwork syscall.Handle
|
|||||||
type hcnEndpoint syscall.Handle
|
type hcnEndpoint syscall.Handle
|
||||||
type hcnNamespace syscall.Handle
|
type hcnNamespace syscall.Handle
|
||||||
type hcnLoadBalancer syscall.Handle
|
type hcnLoadBalancer syscall.Handle
|
||||||
|
type hcnRoute syscall.Handle
|
||||||
type hcnService syscall.Handle
|
type hcnService syscall.Handle
|
||||||
type hcnCallbackHandle syscall.Handle
|
type hcnCallbackHandle syscall.Handle
|
||||||
|
|
||||||
@ -188,6 +198,15 @@ func SessionAffinitySupported() error {
|
|||||||
return platformDoesNotSupportError("Session Affinity")
|
return platformDoesNotSupportError("Session Affinity")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IPv6DualStackSupported returns an error if the HCN version does not support IPv6DualStack.
|
||||||
|
func IPv6DualStackSupported() error {
|
||||||
|
supported := GetSupportedFeatures()
|
||||||
|
if supported.IPv6DualStack {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return platformDoesNotSupportError("IPv6 DualStack")
|
||||||
|
}
|
||||||
|
|
||||||
// RequestType are the different operations performed to settings.
|
// RequestType are the different operations performed to settings.
|
||||||
// Used to update the settings of Endpoint/Namespace objects.
|
// Used to update the settings of Endpoint/Namespace objects.
|
||||||
type RequestType string
|
type RequestType string
|
||||||
|
12
vendor/github.com/Microsoft/hcsshim/hcn/hcnerrors.go
generated
vendored
12
vendor/github.com/Microsoft/hcsshim/hcn/hcnerrors.go
generated
vendored
@ -17,6 +17,7 @@ var (
|
|||||||
errInvalidEndpointID = errors.New("invalid endpoint ID")
|
errInvalidEndpointID = errors.New("invalid endpoint ID")
|
||||||
errInvalidNamespaceID = errors.New("invalid namespace ID")
|
errInvalidNamespaceID = errors.New("invalid namespace ID")
|
||||||
errInvalidLoadBalancerID = errors.New("invalid load balancer ID")
|
errInvalidLoadBalancerID = errors.New("invalid load balancer ID")
|
||||||
|
errInvalidRouteID = errors.New("invalid route ID")
|
||||||
)
|
)
|
||||||
|
|
||||||
func checkForErrors(methodName string, hr error, resultBuffer *uint16) error {
|
func checkForErrors(methodName string, hr error, resultBuffer *uint16) error {
|
||||||
@ -133,6 +134,15 @@ func (e LoadBalancerNotFoundError) Error() string {
|
|||||||
return fmt.Sprintf("LoadBalancer %q not found", e.LoadBalancerId)
|
return fmt.Sprintf("LoadBalancer %q not found", e.LoadBalancerId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RouteNotFoundError results from a failed seach for a route by Id
|
||||||
|
type RouteNotFoundError struct {
|
||||||
|
RouteId string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e RouteNotFoundError) Error() string {
|
||||||
|
return fmt.Sprintf("SDN Route %q not found", e.RouteId)
|
||||||
|
}
|
||||||
|
|
||||||
// IsNotFoundError returns a boolean indicating whether the error was caused by
|
// IsNotFoundError returns a boolean indicating whether the error was caused by
|
||||||
// a resource not being found.
|
// a resource not being found.
|
||||||
func IsNotFoundError(err error) bool {
|
func IsNotFoundError(err error) bool {
|
||||||
@ -145,6 +155,8 @@ func IsNotFoundError(err error) bool {
|
|||||||
return true
|
return true
|
||||||
case LoadBalancerNotFoundError:
|
case LoadBalancerNotFoundError:
|
||||||
return true
|
return true
|
||||||
|
case RouteNotFoundError:
|
||||||
|
return true
|
||||||
case *hcserror.HcsError:
|
case *hcserror.HcsError:
|
||||||
return pe.Err == hcs.ErrElementNotFound
|
return pe.Err == hcs.ErrElementNotFound
|
||||||
}
|
}
|
||||||
|
9
vendor/github.com/Microsoft/hcsshim/hcn/hcnglobals.go
generated
vendored
9
vendor/github.com/Microsoft/hcsshim/hcn/hcnglobals.go
generated
vendored
@ -49,8 +49,13 @@ var (
|
|||||||
VersionRange{MinVersion: Version{Major: 9, Minor: 3}, MaxVersion: Version{Major: 9, Minor: math.MaxInt32}},
|
VersionRange{MinVersion: Version{Major: 9, Minor: 3}, MaxVersion: Version{Major: 9, Minor: math.MaxInt32}},
|
||||||
VersionRange{MinVersion: Version{Major: 10, Minor: 4}, MaxVersion: Version{Major: math.MaxInt32, Minor: math.MaxInt32}},
|
VersionRange{MinVersion: Version{Major: 10, Minor: 4}, MaxVersion: Version{Major: math.MaxInt32, Minor: math.MaxInt32}},
|
||||||
}
|
}
|
||||||
// HNS 11.10 allows for session affinity for loadbalancing
|
// HNS 12.0 allows for session affinity for loadbalancing
|
||||||
SessionAffinityVersion = VersionRanges{VersionRange{MinVersion: Version{Major: 11, Minor: 10}, MaxVersion: Version{Major: math.MaxInt32, Minor: math.MaxInt32}}}
|
SessionAffinityVersion = VersionRanges{VersionRange{MinVersion: Version{Major: 12, Minor: 0}, MaxVersion: Version{Major: math.MaxInt32, Minor: math.MaxInt32}}}
|
||||||
|
// HNS 10.5 through 11 (not included) and 12.0+ supports Ipv6 dual stack.
|
||||||
|
IPv6DualStackVersion = VersionRanges{
|
||||||
|
VersionRange{MinVersion: Version{Major: 10, Minor: 5}, MaxVersion: Version{Major: 10, Minor: math.MaxInt32}},
|
||||||
|
VersionRange{MinVersion: Version{Major: 12, Minor: 0}, MaxVersion: Version{Major: math.MaxInt32, Minor: math.MaxInt32}},
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetGlobals returns the global properties of the HCN Service.
|
// GetGlobals returns the global properties of the HCN Service.
|
||||||
|
266
vendor/github.com/Microsoft/hcsshim/hcn/hcnroute.go
generated
vendored
Normal file
266
vendor/github.com/Microsoft/hcsshim/hcn/hcnroute.go
generated
vendored
Normal file
@ -0,0 +1,266 @@
|
|||||||
|
package hcn
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
|
|
||||||
|
"github.com/Microsoft/go-winio/pkg/guid"
|
||||||
|
"github.com/Microsoft/hcsshim/internal/interop"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
|
)
|
||||||
|
|
||||||
|
// HostComputeRoute represents SDN routes.
|
||||||
|
type HostComputeRoute struct {
|
||||||
|
ID string `json:"ID,omitempty"`
|
||||||
|
HostComputeEndpoints []string `json:",omitempty"`
|
||||||
|
Setting []SDNRoutePolicySetting `json:",omitempty"`
|
||||||
|
SchemaVersion SchemaVersion `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListRoutes makes a call to list all available routes.
|
||||||
|
func ListRoutes() ([]HostComputeRoute, error) {
|
||||||
|
hcnQuery := defaultQuery()
|
||||||
|
routes, err := ListRoutesQuery(hcnQuery)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return routes, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListRoutesQuery makes a call to query the list of available routes.
|
||||||
|
func ListRoutesQuery(query HostComputeQuery) ([]HostComputeRoute, error) {
|
||||||
|
queryJSON, err := json.Marshal(query)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
routes, err := enumerateRoutes(string(queryJSON))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return routes, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetRouteByID returns the route specified by Id.
|
||||||
|
func GetRouteByID(routeID string) (*HostComputeRoute, error) {
|
||||||
|
hcnQuery := defaultQuery()
|
||||||
|
mapA := map[string]string{"ID": routeID}
|
||||||
|
filter, err := json.Marshal(mapA)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
hcnQuery.Filter = string(filter)
|
||||||
|
|
||||||
|
routes, err := ListRoutesQuery(hcnQuery)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if len(routes) == 0 {
|
||||||
|
return nil, RouteNotFoundError{RouteId: routeID}
|
||||||
|
}
|
||||||
|
return &routes[0], err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create Route.
|
||||||
|
func (route *HostComputeRoute) Create() (*HostComputeRoute, error) {
|
||||||
|
logrus.Debugf("hcn::HostComputeRoute::Create id=%s", route.ID)
|
||||||
|
|
||||||
|
jsonString, err := json.Marshal(route)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
logrus.Debugf("hcn::HostComputeRoute::Create JSON: %s", jsonString)
|
||||||
|
route, hcnErr := createRoute(string(jsonString))
|
||||||
|
if hcnErr != nil {
|
||||||
|
return nil, hcnErr
|
||||||
|
}
|
||||||
|
return route, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete Route.
|
||||||
|
func (route *HostComputeRoute) Delete() error {
|
||||||
|
logrus.Debugf("hcn::HostComputeRoute::Delete id=%s", route.ID)
|
||||||
|
|
||||||
|
existingRoute, _ := GetRouteByID(route.ID)
|
||||||
|
|
||||||
|
if existingRoute != nil {
|
||||||
|
if err := deleteRoute(route.ID); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddEndpoint add an endpoint to a route
|
||||||
|
// Since HCNRoute doesn't implement modify functionality, add operation is essentially delete and add
|
||||||
|
func (route *HostComputeRoute) AddEndpoint(endpoint *HostComputeEndpoint) (*HostComputeRoute, error) {
|
||||||
|
logrus.Debugf("hcn::HostComputeRoute::AddEndpoint route=%s endpoint=%s", route.ID, endpoint.Id)
|
||||||
|
|
||||||
|
err := route.Delete()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add Endpoint to the Existing List
|
||||||
|
route.HostComputeEndpoints = append(route.HostComputeEndpoints, endpoint.Id)
|
||||||
|
|
||||||
|
return route.Create()
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveEndpoint removes an endpoint from a route
|
||||||
|
// Since HCNRoute doesn't implement modify functionality, remove operation is essentially delete and add
|
||||||
|
func (route *HostComputeRoute) RemoveEndpoint(endpoint *HostComputeEndpoint) (*HostComputeRoute, error) {
|
||||||
|
logrus.Debugf("hcn::HostComputeRoute::RemoveEndpoint route=%s endpoint=%s", route.ID, endpoint.Id)
|
||||||
|
|
||||||
|
err := route.Delete()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a list of all the endpoints besides the one being removed
|
||||||
|
i := 0
|
||||||
|
for index, endpointReference := range route.HostComputeEndpoints {
|
||||||
|
if endpointReference == endpoint.Id {
|
||||||
|
i = index
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
route.HostComputeEndpoints = append(route.HostComputeEndpoints[0:i], route.HostComputeEndpoints[i+1:]...)
|
||||||
|
return route.Create()
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddRoute for the specified endpoints and SDN Route setting
|
||||||
|
func AddRoute(endpoints []HostComputeEndpoint, destinationPrefix string, nextHop string, needEncapsulation bool) (*HostComputeRoute, error) {
|
||||||
|
logrus.Debugf("hcn::HostComputeRoute::AddRoute endpointId=%v, destinationPrefix=%v, nextHop=%v, needEncapsulation=%v", endpoints, destinationPrefix, nextHop, needEncapsulation)
|
||||||
|
|
||||||
|
if len(endpoints) <= 0 {
|
||||||
|
return nil, errors.New("Missing endpoints")
|
||||||
|
}
|
||||||
|
|
||||||
|
route := &HostComputeRoute{
|
||||||
|
SchemaVersion: V2SchemaVersion(),
|
||||||
|
Setting: []SDNRoutePolicySetting{
|
||||||
|
{
|
||||||
|
DestinationPrefix: destinationPrefix,
|
||||||
|
NextHop: nextHop,
|
||||||
|
NeedEncap: needEncapsulation,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, endpoint := range endpoints {
|
||||||
|
route.HostComputeEndpoints = append(route.HostComputeEndpoints, endpoint.Id)
|
||||||
|
}
|
||||||
|
|
||||||
|
return route.Create()
|
||||||
|
}
|
||||||
|
|
||||||
|
func enumerateRoutes(query string) ([]HostComputeRoute, error) {
|
||||||
|
// Enumerate all routes Guids
|
||||||
|
var (
|
||||||
|
resultBuffer *uint16
|
||||||
|
routeBuffer *uint16
|
||||||
|
)
|
||||||
|
hr := hcnEnumerateRoutes(query, &routeBuffer, &resultBuffer)
|
||||||
|
if err := checkForErrors("hcnEnumerateRoutes", hr, resultBuffer); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
routes := interop.ConvertAndFreeCoTaskMemString(routeBuffer)
|
||||||
|
var routeIds []guid.GUID
|
||||||
|
if err := json.Unmarshal([]byte(routes), &routeIds); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var outputRoutes []HostComputeRoute
|
||||||
|
for _, routeGUID := range routeIds {
|
||||||
|
route, err := getRoute(routeGUID, query)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
outputRoutes = append(outputRoutes, *route)
|
||||||
|
}
|
||||||
|
return outputRoutes, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func getRoute(routeGUID guid.GUID, query string) (*HostComputeRoute, error) {
|
||||||
|
// Open routes.
|
||||||
|
var (
|
||||||
|
routeHandle hcnRoute
|
||||||
|
resultBuffer *uint16
|
||||||
|
propertiesBuffer *uint16
|
||||||
|
)
|
||||||
|
hr := hcnOpenRoute(&routeGUID, &routeHandle, &resultBuffer)
|
||||||
|
if err := checkForErrors("hcnOpenRoute", hr, resultBuffer); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
// Query routes.
|
||||||
|
hr = hcnQueryRouteProperties(routeHandle, query, &propertiesBuffer, &resultBuffer)
|
||||||
|
if err := checkForErrors("hcnQueryRouteProperties", hr, resultBuffer); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
properties := interop.ConvertAndFreeCoTaskMemString(propertiesBuffer)
|
||||||
|
// Close routes.
|
||||||
|
hr = hcnCloseRoute(routeHandle)
|
||||||
|
if err := checkForErrors("hcnCloseRoute", hr, nil); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
// Convert output to HostComputeRoute
|
||||||
|
var outputRoute HostComputeRoute
|
||||||
|
if err := json.Unmarshal([]byte(properties), &outputRoute); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &outputRoute, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func createRoute(settings string) (*HostComputeRoute, error) {
|
||||||
|
// Create new route.
|
||||||
|
var (
|
||||||
|
routeHandle hcnRoute
|
||||||
|
resultBuffer *uint16
|
||||||
|
propertiesBuffer *uint16
|
||||||
|
)
|
||||||
|
routeGUID := guid.GUID{}
|
||||||
|
hr := hcnCreateRoute(&routeGUID, settings, &routeHandle, &resultBuffer)
|
||||||
|
if err := checkForErrors("hcnCreateRoute", hr, resultBuffer); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
// Query route.
|
||||||
|
hcnQuery := defaultQuery()
|
||||||
|
query, err := json.Marshal(hcnQuery)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
hr = hcnQueryRouteProperties(routeHandle, string(query), &propertiesBuffer, &resultBuffer)
|
||||||
|
if err := checkForErrors("hcnQueryRouteProperties", hr, resultBuffer); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
properties := interop.ConvertAndFreeCoTaskMemString(propertiesBuffer)
|
||||||
|
// Close Route.
|
||||||
|
hr = hcnCloseRoute(routeHandle)
|
||||||
|
if err := checkForErrors("hcnCloseRoute", hr, nil); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
// Convert output to HostComputeRoute
|
||||||
|
var outputRoute HostComputeRoute
|
||||||
|
if err := json.Unmarshal([]byte(properties), &outputRoute); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &outputRoute, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func deleteRoute(routeID string) error {
|
||||||
|
routeGUID, err := guid.FromString(routeID)
|
||||||
|
if err != nil {
|
||||||
|
return errInvalidRouteID
|
||||||
|
}
|
||||||
|
var resultBuffer *uint16
|
||||||
|
hr := hcnDeleteRoute(&routeGUID, &resultBuffer)
|
||||||
|
if err := checkForErrors("hcnDeleteRoute", hr, resultBuffer); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
2
vendor/github.com/Microsoft/hcsshim/hcn/hcnsupport.go
generated
vendored
2
vendor/github.com/Microsoft/hcsshim/hcn/hcnsupport.go
generated
vendored
@ -14,6 +14,7 @@ type SupportedFeatures struct {
|
|||||||
Slash32EndpointPrefixes bool `json:"Slash32EndpointPrefixes"`
|
Slash32EndpointPrefixes bool `json:"Slash32EndpointPrefixes"`
|
||||||
AclSupportForProtocol252 bool `json:"AclSupportForProtocol252"`
|
AclSupportForProtocol252 bool `json:"AclSupportForProtocol252"`
|
||||||
SessionAffinity bool `json:"SessionAffinity"`
|
SessionAffinity bool `json:"SessionAffinity"`
|
||||||
|
IPv6DualStack bool `json:"IPv6DualStack"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// AclFeatures are the supported ACL possibilities.
|
// AclFeatures are the supported ACL possibilities.
|
||||||
@ -59,6 +60,7 @@ func GetSupportedFeatures() SupportedFeatures {
|
|||||||
features.Slash32EndpointPrefixes = isFeatureSupported(globals.Version, Slash32EndpointPrefixesVersion)
|
features.Slash32EndpointPrefixes = isFeatureSupported(globals.Version, Slash32EndpointPrefixesVersion)
|
||||||
features.AclSupportForProtocol252 = isFeatureSupported(globals.Version, AclSupportForProtocol252Version)
|
features.AclSupportForProtocol252 = isFeatureSupported(globals.Version, AclSupportForProtocol252Version)
|
||||||
features.SessionAffinity = isFeatureSupported(globals.Version, SessionAffinityVersion)
|
features.SessionAffinity = isFeatureSupported(globals.Version, SessionAffinityVersion)
|
||||||
|
features.IPv6DualStack = isFeatureSupported(globals.Version, IPv6DualStackVersion)
|
||||||
|
|
||||||
return features
|
return features
|
||||||
}
|
}
|
||||||
|
141
vendor/github.com/Microsoft/hcsshim/hcn/zsyscall_windows.go
generated
vendored
141
vendor/github.com/Microsoft/hcsshim/hcn/zsyscall_windows.go
generated
vendored
@ -71,6 +71,13 @@ var (
|
|||||||
procHcnQueryLoadBalancerProperties = modcomputenetwork.NewProc("HcnQueryLoadBalancerProperties")
|
procHcnQueryLoadBalancerProperties = modcomputenetwork.NewProc("HcnQueryLoadBalancerProperties")
|
||||||
procHcnDeleteLoadBalancer = modcomputenetwork.NewProc("HcnDeleteLoadBalancer")
|
procHcnDeleteLoadBalancer = modcomputenetwork.NewProc("HcnDeleteLoadBalancer")
|
||||||
procHcnCloseLoadBalancer = modcomputenetwork.NewProc("HcnCloseLoadBalancer")
|
procHcnCloseLoadBalancer = modcomputenetwork.NewProc("HcnCloseLoadBalancer")
|
||||||
|
procHcnEnumerateSdnRoutes = modcomputenetwork.NewProc("HcnEnumerateSdnRoutes")
|
||||||
|
procHcnCreateSdnRoute = modcomputenetwork.NewProc("HcnCreateSdnRoute")
|
||||||
|
procHcnOpenSdnRoute = modcomputenetwork.NewProc("HcnOpenSdnRoute")
|
||||||
|
procHcnModifySdnRoute = modcomputenetwork.NewProc("HcnModifySdnRoute")
|
||||||
|
procHcnQuerySdnRouteProperties = modcomputenetwork.NewProc("HcnQuerySdnRouteProperties")
|
||||||
|
procHcnDeleteSdnRoute = modcomputenetwork.NewProc("HcnDeleteSdnRoute")
|
||||||
|
procHcnCloseSdnRoute = modcomputenetwork.NewProc("HcnCloseSdnRoute")
|
||||||
procHcnOpenService = modcomputenetwork.NewProc("HcnOpenService")
|
procHcnOpenService = modcomputenetwork.NewProc("HcnOpenService")
|
||||||
procHcnRegisterServiceCallback = modcomputenetwork.NewProc("HcnRegisterServiceCallback")
|
procHcnRegisterServiceCallback = modcomputenetwork.NewProc("HcnRegisterServiceCallback")
|
||||||
procHcnUnregisterServiceCallback = modcomputenetwork.NewProc("HcnUnregisterServiceCallback")
|
procHcnUnregisterServiceCallback = modcomputenetwork.NewProc("HcnUnregisterServiceCallback")
|
||||||
@ -657,6 +664,140 @@ func hcnCloseLoadBalancer(loadBalancer hcnLoadBalancer) (hr error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func hcnEnumerateRoutes(query string, routes **uint16, result **uint16) (hr error) {
|
||||||
|
var _p0 *uint16
|
||||||
|
_p0, hr = syscall.UTF16PtrFromString(query)
|
||||||
|
if hr != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return _hcnEnumerateRoutes(_p0, routes, result)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _hcnEnumerateRoutes(query *uint16, routes **uint16, result **uint16) (hr error) {
|
||||||
|
if hr = procHcnEnumerateSdnRoutes.Find(); hr != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r0, _, _ := syscall.Syscall(procHcnEnumerateSdnRoutes.Addr(), 3, uintptr(unsafe.Pointer(query)), uintptr(unsafe.Pointer(routes)), uintptr(unsafe.Pointer(result)))
|
||||||
|
if int32(r0) < 0 {
|
||||||
|
if r0&0x1fff0000 == 0x00070000 {
|
||||||
|
r0 &= 0xffff
|
||||||
|
}
|
||||||
|
hr = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func hcnCreateRoute(id *_guid, settings string, route *hcnRoute, result **uint16) (hr error) {
|
||||||
|
var _p0 *uint16
|
||||||
|
_p0, hr = syscall.UTF16PtrFromString(settings)
|
||||||
|
if hr != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return _hcnCreateRoute(id, _p0, route, result)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _hcnCreateRoute(id *_guid, settings *uint16, route *hcnRoute, result **uint16) (hr error) {
|
||||||
|
if hr = procHcnCreateSdnRoute.Find(); hr != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r0, _, _ := syscall.Syscall6(procHcnCreateSdnRoute.Addr(), 4, uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(settings)), uintptr(unsafe.Pointer(route)), uintptr(unsafe.Pointer(result)), 0, 0)
|
||||||
|
if int32(r0) < 0 {
|
||||||
|
if r0&0x1fff0000 == 0x00070000 {
|
||||||
|
r0 &= 0xffff
|
||||||
|
}
|
||||||
|
hr = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func hcnOpenRoute(id *_guid, route *hcnRoute, result **uint16) (hr error) {
|
||||||
|
if hr = procHcnOpenSdnRoute.Find(); hr != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r0, _, _ := syscall.Syscall(procHcnOpenSdnRoute.Addr(), 3, uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(route)), uintptr(unsafe.Pointer(result)))
|
||||||
|
if int32(r0) < 0 {
|
||||||
|
if r0&0x1fff0000 == 0x00070000 {
|
||||||
|
r0 &= 0xffff
|
||||||
|
}
|
||||||
|
hr = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func hcnModifyRoute(route hcnRoute, settings string, result **uint16) (hr error) {
|
||||||
|
var _p0 *uint16
|
||||||
|
_p0, hr = syscall.UTF16PtrFromString(settings)
|
||||||
|
if hr != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return _hcnModifyRoute(route, _p0, result)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _hcnModifyRoute(route hcnRoute, settings *uint16, result **uint16) (hr error) {
|
||||||
|
if hr = procHcnModifySdnRoute.Find(); hr != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r0, _, _ := syscall.Syscall(procHcnModifySdnRoute.Addr(), 3, uintptr(route), uintptr(unsafe.Pointer(settings)), uintptr(unsafe.Pointer(result)))
|
||||||
|
if int32(r0) < 0 {
|
||||||
|
if r0&0x1fff0000 == 0x00070000 {
|
||||||
|
r0 &= 0xffff
|
||||||
|
}
|
||||||
|
hr = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func hcnQueryRouteProperties(route hcnRoute, query string, properties **uint16, result **uint16) (hr error) {
|
||||||
|
var _p0 *uint16
|
||||||
|
_p0, hr = syscall.UTF16PtrFromString(query)
|
||||||
|
if hr != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return _hcnQueryRouteProperties(route, _p0, properties, result)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _hcnQueryRouteProperties(route hcnRoute, query *uint16, properties **uint16, result **uint16) (hr error) {
|
||||||
|
if hr = procHcnQuerySdnRouteProperties.Find(); hr != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r0, _, _ := syscall.Syscall6(procHcnQuerySdnRouteProperties.Addr(), 4, uintptr(route), uintptr(unsafe.Pointer(query)), uintptr(unsafe.Pointer(properties)), uintptr(unsafe.Pointer(result)), 0, 0)
|
||||||
|
if int32(r0) < 0 {
|
||||||
|
if r0&0x1fff0000 == 0x00070000 {
|
||||||
|
r0 &= 0xffff
|
||||||
|
}
|
||||||
|
hr = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func hcnDeleteRoute(id *_guid, result **uint16) (hr error) {
|
||||||
|
if hr = procHcnDeleteSdnRoute.Find(); hr != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r0, _, _ := syscall.Syscall(procHcnDeleteSdnRoute.Addr(), 2, uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(result)), 0)
|
||||||
|
if int32(r0) < 0 {
|
||||||
|
if r0&0x1fff0000 == 0x00070000 {
|
||||||
|
r0 &= 0xffff
|
||||||
|
}
|
||||||
|
hr = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func hcnCloseRoute(route hcnRoute) (hr error) {
|
||||||
|
if hr = procHcnCloseSdnRoute.Find(); hr != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r0, _, _ := syscall.Syscall(procHcnCloseSdnRoute.Addr(), 1, uintptr(route), 0, 0)
|
||||||
|
if int32(r0) < 0 {
|
||||||
|
if r0&0x1fff0000 == 0x00070000 {
|
||||||
|
r0 &= 0xffff
|
||||||
|
}
|
||||||
|
hr = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func hcnOpenService(service *hcnService, result **uint16) (hr error) {
|
func hcnOpenService(service *hcnService, result **uint16) (hr error) {
|
||||||
if hr = procHcnOpenService.Find(); hr != nil {
|
if hr = procHcnOpenService.Find(); hr != nil {
|
||||||
return
|
return
|
||||||
|
3
vendor/github.com/Microsoft/hcsshim/hnspolicy.go
generated
vendored
3
vendor/github.com/Microsoft/hcsshim/hnspolicy.go
generated
vendored
@ -21,8 +21,11 @@ const (
|
|||||||
OutboundNat = hns.OutboundNat
|
OutboundNat = hns.OutboundNat
|
||||||
ExternalLoadBalancer = hns.ExternalLoadBalancer
|
ExternalLoadBalancer = hns.ExternalLoadBalancer
|
||||||
Route = hns.Route
|
Route = hns.Route
|
||||||
|
Proxy = hns.Proxy
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type ProxyPolicy = hns.ProxyPolicy
|
||||||
|
|
||||||
type NatPolicy = hns.NatPolicy
|
type NatPolicy = hns.NatPolicy
|
||||||
|
|
||||||
type QosPolicy = hns.QosPolicy
|
type QosPolicy = hns.QosPolicy
|
||||||
|
5
vendor/github.com/Microsoft/hcsshim/internal/hcs/syscall.go
generated
vendored
Normal file
5
vendor/github.com/Microsoft/hcsshim/internal/hcs/syscall.go
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package hcs
|
||||||
|
|
||||||
|
//go:generate go run ../../mksyscall_windows.go -output zsyscall_windows.go syscall.go
|
||||||
|
|
||||||
|
//sys hcsFormatWritableLayerVhd(handle uintptr) (hr error) = computestorage.HcsFormatWritableLayerVhd
|
28
vendor/github.com/Microsoft/hcsshim/internal/hcs/utils.go
generated
vendored
28
vendor/github.com/Microsoft/hcsshim/internal/hcs/utils.go
generated
vendored
@ -1,10 +1,14 @@
|
|||||||
package hcs
|
package hcs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"io"
|
"io"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/Microsoft/go-winio"
|
"github.com/Microsoft/go-winio"
|
||||||
|
diskutil "github.com/Microsoft/go-winio/vhd"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"golang.org/x/sys/windows"
|
||||||
)
|
)
|
||||||
|
|
||||||
// makeOpenFiles calls winio.MakeOpenFile for each handle in a slice but closes all the handles
|
// makeOpenFiles calls winio.MakeOpenFile for each handle in a slice but closes all the handles
|
||||||
@ -31,3 +35,27 @@ func makeOpenFiles(hs []syscall.Handle) (_ []io.ReadWriteCloser, err error) {
|
|||||||
}
|
}
|
||||||
return fs, nil
|
return fs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// creates a VHD formatted with NTFS of size `sizeGB` at the given `vhdPath`.
|
||||||
|
func CreateNTFSVHD(ctx context.Context, vhdPath string, sizeGB uint32) (err error) {
|
||||||
|
if err := diskutil.CreateVhdx(vhdPath, sizeGB, 1); err != nil {
|
||||||
|
return errors.Wrap(err, "failed to create VHD")
|
||||||
|
}
|
||||||
|
|
||||||
|
vhd, err := diskutil.OpenVirtualDisk(vhdPath, diskutil.VirtualDiskAccessNone, diskutil.OpenVirtualDiskFlagNone)
|
||||||
|
if err != nil {
|
||||||
|
return errors.Wrap(err, "failed to open VHD")
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
err2 := windows.CloseHandle(windows.Handle(vhd))
|
||||||
|
if err == nil {
|
||||||
|
err = errors.Wrap(err2, "failed to close VHD")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
if err := hcsFormatWritableLayerVhd(uintptr(vhd)); err != nil {
|
||||||
|
return errors.Wrap(err, "failed to format VHD")
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
54
vendor/github.com/Microsoft/hcsshim/internal/hcs/zsyscall_windows.go
generated
vendored
Normal file
54
vendor/github.com/Microsoft/hcsshim/internal/hcs/zsyscall_windows.go
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
// Code generated mksyscall_windows.exe DO NOT EDIT
|
||||||
|
|
||||||
|
package hcs
|
||||||
|
|
||||||
|
import (
|
||||||
|
"syscall"
|
||||||
|
"unsafe"
|
||||||
|
|
||||||
|
"golang.org/x/sys/windows"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ unsafe.Pointer
|
||||||
|
|
||||||
|
// Do the interface allocations only once for common
|
||||||
|
// Errno values.
|
||||||
|
const (
|
||||||
|
errnoERROR_IO_PENDING = 997
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING)
|
||||||
|
)
|
||||||
|
|
||||||
|
// errnoErr returns common boxed Errno values, to prevent
|
||||||
|
// allocations at runtime.
|
||||||
|
func errnoErr(e syscall.Errno) error {
|
||||||
|
switch e {
|
||||||
|
case 0:
|
||||||
|
return nil
|
||||||
|
case errnoERROR_IO_PENDING:
|
||||||
|
return errERROR_IO_PENDING
|
||||||
|
}
|
||||||
|
// TODO: add more here, after collecting data on the common
|
||||||
|
// error values see on Windows. (perhaps when running
|
||||||
|
// all.bat?)
|
||||||
|
return e
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
modcomputestorage = windows.NewLazySystemDLL("computestorage.dll")
|
||||||
|
|
||||||
|
procHcsFormatWritableLayerVhd = modcomputestorage.NewProc("HcsFormatWritableLayerVhd")
|
||||||
|
)
|
||||||
|
|
||||||
|
func hcsFormatWritableLayerVhd(handle uintptr) (hr error) {
|
||||||
|
r0, _, _ := syscall.Syscall(procHcsFormatWritableLayerVhd.Addr(), 1, uintptr(handle), 0, 0)
|
||||||
|
if int32(r0) < 0 {
|
||||||
|
if r0&0x1fff0000 == 0x00070000 {
|
||||||
|
r0 &= 0xffff
|
||||||
|
}
|
||||||
|
hr = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
21
vendor/github.com/Microsoft/hcsshim/internal/hns/hnsendpoint.go
generated
vendored
21
vendor/github.com/Microsoft/hcsshim/internal/hns/hnsendpoint.go
generated
vendored
@ -173,6 +173,27 @@ func (endpoint *HNSEndpoint) ApplyACLPolicy(policies ...*ACLPolicy) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ApplyProxyPolicy applies a set of Proxy Policies on the Endpoint
|
||||||
|
func (endpoint *HNSEndpoint) ApplyProxyPolicy(policies ...*ProxyPolicy) error {
|
||||||
|
operation := "ApplyProxyPolicy"
|
||||||
|
title := "hcsshim::HNSEndpoint::" + operation
|
||||||
|
logrus.Debugf(title+" id=%s", endpoint.Id)
|
||||||
|
|
||||||
|
for _, policy := range policies {
|
||||||
|
if policy == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
jsonString, err := json.Marshal(policy)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
endpoint.Policies = append(endpoint.Policies, jsonString)
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := endpoint.Update()
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// ContainerAttach attaches an endpoint to container
|
// ContainerAttach attaches an endpoint to container
|
||||||
func (endpoint *HNSEndpoint) ContainerAttach(containerID string, compartmentID uint16) error {
|
func (endpoint *HNSEndpoint) ContainerAttach(containerID string, compartmentID uint16) error {
|
||||||
operation := "ContainerAttach"
|
operation := "ContainerAttach"
|
||||||
|
10
vendor/github.com/Microsoft/hcsshim/internal/hns/hnspolicy.go
generated
vendored
10
vendor/github.com/Microsoft/hcsshim/internal/hns/hnspolicy.go
generated
vendored
@ -17,6 +17,7 @@ const (
|
|||||||
OutboundNat PolicyType = "OutBoundNAT"
|
OutboundNat PolicyType = "OutBoundNAT"
|
||||||
ExternalLoadBalancer PolicyType = "ELB"
|
ExternalLoadBalancer PolicyType = "ELB"
|
||||||
Route PolicyType = "ROUTE"
|
Route PolicyType = "ROUTE"
|
||||||
|
Proxy PolicyType = "PROXY"
|
||||||
)
|
)
|
||||||
|
|
||||||
type NatPolicy struct {
|
type NatPolicy struct {
|
||||||
@ -60,6 +61,15 @@ type OutboundNatPolicy struct {
|
|||||||
Destinations []string `json:",omitempty"`
|
Destinations []string `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ProxyPolicy struct {
|
||||||
|
Type PolicyType `json:"Type"`
|
||||||
|
IP string `json:",omitempty"`
|
||||||
|
Port string `json:",omitempty"`
|
||||||
|
ExceptionList []string `json:",omitempty"`
|
||||||
|
Destination string `json:",omitempty"`
|
||||||
|
OutboundNat bool `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
type ActionType string
|
type ActionType string
|
||||||
type DirectionType string
|
type DirectionType string
|
||||||
type RuleType string
|
type RuleType string
|
||||||
|
4
vendor/github.com/Microsoft/hcsshim/internal/schema2/devices.go
generated
vendored
4
vendor/github.com/Microsoft/hcsshim/internal/schema2/devices.go
generated
vendored
@ -39,4 +39,8 @@ type Devices struct {
|
|||||||
FlexibleIov map[string]FlexibleIoDevice `json:"FlexibleIov,omitempty"`
|
FlexibleIov map[string]FlexibleIoDevice `json:"FlexibleIov,omitempty"`
|
||||||
|
|
||||||
SharedMemory *SharedMemoryConfiguration `json:"SharedMemory,omitempty"`
|
SharedMemory *SharedMemoryConfiguration `json:"SharedMemory,omitempty"`
|
||||||
|
|
||||||
|
// TODO: This is pre-release support in schema 2.3. Need to add build number
|
||||||
|
// docs when a public build with this is out.
|
||||||
|
VirtualPci map[string]VirtualPciDevice `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
19
vendor/github.com/Microsoft/hcsshim/internal/schema2/memory_2.go
generated
vendored
19
vendor/github.com/Microsoft/hcsshim/internal/schema2/memory_2.go
generated
vendored
@ -27,4 +27,23 @@ type Memory2 struct {
|
|||||||
// to the VM, allowing it to trim non-zeroed pages from the working set (if supported by
|
// to the VM, allowing it to trim non-zeroed pages from the working set (if supported by
|
||||||
// the guest operating system).
|
// the guest operating system).
|
||||||
EnableColdDiscardHint bool `json:"EnableColdDiscardHint,omitempty"`
|
EnableColdDiscardHint bool `json:"EnableColdDiscardHint,omitempty"`
|
||||||
|
|
||||||
|
// LowMmioGapInMB is the low MMIO region allocated below 4GB.
|
||||||
|
//
|
||||||
|
// TODO: This is pre-release support in schema 2.3. Need to add build number
|
||||||
|
// docs when a public build with this is out.
|
||||||
|
LowMMIOGapInMB uint64 `json:"LowMmioGapInMB,omitempty"`
|
||||||
|
|
||||||
|
// HighMmioBaseInMB is the high MMIO region allocated above 4GB (base and
|
||||||
|
// size).
|
||||||
|
//
|
||||||
|
// TODO: This is pre-release support in schema 2.3. Need to add build number
|
||||||
|
// docs when a public build with this is out.
|
||||||
|
HighMMIOBaseInMB uint64 `json:"HighMmioBaseInMB,omitempty"`
|
||||||
|
|
||||||
|
// HighMmioGapInMB is the high MMIO region.
|
||||||
|
//
|
||||||
|
// TODO: This is pre-release support in schema 2.3. Need to add build number
|
||||||
|
// docs when a public build with this is out.
|
||||||
|
HighMMIOGapInMB uint64 `json:"HighMmioGapInMB,omitempty"`
|
||||||
}
|
}
|
||||||
|
16
vendor/github.com/Microsoft/hcsshim/internal/schema2/virtual_pci_device.go
generated
vendored
Normal file
16
vendor/github.com/Microsoft/hcsshim/internal/schema2/virtual_pci_device.go
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* HCS API
|
||||||
|
*
|
||||||
|
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
||||||
|
*
|
||||||
|
* API version: 2.3
|
||||||
|
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package hcsschema
|
||||||
|
|
||||||
|
// TODO: This is pre-release support in schema 2.3. Need to add build number
|
||||||
|
// docs when a public build with this is out.
|
||||||
|
type VirtualPciDevice struct {
|
||||||
|
Functions []VirtualPciFunction `json:",omitempty"`
|
||||||
|
}
|
18
vendor/github.com/Microsoft/hcsshim/internal/schema2/virtual_pci_function.go
generated
vendored
Normal file
18
vendor/github.com/Microsoft/hcsshim/internal/schema2/virtual_pci_function.go
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* HCS API
|
||||||
|
*
|
||||||
|
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
||||||
|
*
|
||||||
|
* API version: 2.3
|
||||||
|
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package hcsschema
|
||||||
|
|
||||||
|
// TODO: This is pre-release support in schema 2.3. Need to add build number
|
||||||
|
// docs when a public build with this is out.
|
||||||
|
type VirtualPciFunction struct {
|
||||||
|
DeviceInstancePath string `json:",omitempty"`
|
||||||
|
|
||||||
|
VirtualFunction uint16 `json:",omitempty"`
|
||||||
|
}
|
23
vendor/github.com/Microsoft/hcsshim/internal/wclayer/activatelayer.go
generated
vendored
23
vendor/github.com/Microsoft/hcsshim/internal/wclayer/activatelayer.go
generated
vendored
@ -1,28 +1,23 @@
|
|||||||
package wclayer
|
package wclayer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
"github.com/Microsoft/hcsshim/internal/hcserror"
|
"github.com/Microsoft/hcsshim/internal/hcserror"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/Microsoft/hcsshim/internal/oc"
|
||||||
|
"go.opencensus.io/trace"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ActivateLayer will find the layer with the given id and mount it's filesystem.
|
// ActivateLayer will find the layer with the given id and mount it's filesystem.
|
||||||
// For a read/write layer, the mounted filesystem will appear as a volume on the
|
// For a read/write layer, the mounted filesystem will appear as a volume on the
|
||||||
// host, while a read-only layer is generally expected to be a no-op.
|
// host, while a read-only layer is generally expected to be a no-op.
|
||||||
// An activated layer must later be deactivated via DeactivateLayer.
|
// An activated layer must later be deactivated via DeactivateLayer.
|
||||||
func ActivateLayer(path string) (err error) {
|
func ActivateLayer(ctx context.Context, path string) (err error) {
|
||||||
title := "hcsshim::ActivateLayer"
|
title := "hcsshim::ActivateLayer"
|
||||||
fields := logrus.Fields{
|
ctx, span := trace.StartSpan(ctx, title)
|
||||||
"path": path,
|
defer span.End()
|
||||||
}
|
defer func() { oc.SetSpanStatus(span, err) }()
|
||||||
logrus.WithFields(fields).Debug(title)
|
span.AddAttributes(trace.StringAttribute("path", path))
|
||||||
defer func() {
|
|
||||||
if err != nil {
|
|
||||||
fields[logrus.ErrorKey] = err
|
|
||||||
logrus.WithFields(fields).Error(err)
|
|
||||||
} else {
|
|
||||||
logrus.WithFields(fields).Debug(title + " - succeeded")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
err = activateLayer(&stdDriverInfo, path)
|
err = activateLayer(&stdDriverInfo, path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
17
vendor/github.com/Microsoft/hcsshim/internal/wclayer/baselayer.go
generated
vendored
17
vendor/github.com/Microsoft/hcsshim/internal/wclayer/baselayer.go
generated
vendored
@ -1,6 +1,7 @@
|
|||||||
package wclayer
|
package wclayer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -8,10 +9,15 @@ import (
|
|||||||
|
|
||||||
"github.com/Microsoft/go-winio"
|
"github.com/Microsoft/go-winio"
|
||||||
"github.com/Microsoft/hcsshim/internal/hcserror"
|
"github.com/Microsoft/hcsshim/internal/hcserror"
|
||||||
|
"github.com/Microsoft/hcsshim/internal/oc"
|
||||||
"github.com/Microsoft/hcsshim/internal/safefile"
|
"github.com/Microsoft/hcsshim/internal/safefile"
|
||||||
|
"go.opencensus.io/trace"
|
||||||
)
|
)
|
||||||
|
|
||||||
type baseLayerWriter struct {
|
type baseLayerWriter struct {
|
||||||
|
ctx context.Context
|
||||||
|
s *trace.Span
|
||||||
|
|
||||||
root *os.File
|
root *os.File
|
||||||
f *os.File
|
f *os.File
|
||||||
bw *winio.BackupFileWriter
|
bw *winio.BackupFileWriter
|
||||||
@ -136,12 +142,15 @@ func (w *baseLayerWriter) Write(b []byte) (int, error) {
|
|||||||
return n, err
|
return n, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *baseLayerWriter) Close() error {
|
func (w *baseLayerWriter) Close() (err error) {
|
||||||
|
defer w.s.End()
|
||||||
|
defer func() { oc.SetSpanStatus(w.s, err) }()
|
||||||
defer func() {
|
defer func() {
|
||||||
w.root.Close()
|
w.root.Close()
|
||||||
w.root = nil
|
w.root = nil
|
||||||
}()
|
}()
|
||||||
err := w.closeCurrentFile()
|
|
||||||
|
err = w.closeCurrentFile()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -153,7 +162,7 @@ func (w *baseLayerWriter) Close() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ProcessBaseLayer(w.root.Name())
|
err = ProcessBaseLayer(w.ctx, w.root.Name())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -163,7 +172,7 @@ func (w *baseLayerWriter) Close() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = ProcessUtilityVMImage(filepath.Join(w.root.Name(), "UtilityVM"))
|
err = ProcessUtilityVMImage(w.ctx, filepath.Join(w.root.Name(), "UtilityVM"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
26
vendor/github.com/Microsoft/hcsshim/internal/wclayer/createlayer.go
generated
vendored
26
vendor/github.com/Microsoft/hcsshim/internal/wclayer/createlayer.go
generated
vendored
@ -1,27 +1,23 @@
|
|||||||
package wclayer
|
package wclayer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
"github.com/Microsoft/hcsshim/internal/hcserror"
|
"github.com/Microsoft/hcsshim/internal/hcserror"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/Microsoft/hcsshim/internal/oc"
|
||||||
|
"go.opencensus.io/trace"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CreateLayer creates a new, empty, read-only layer on the filesystem based on
|
// CreateLayer creates a new, empty, read-only layer on the filesystem based on
|
||||||
// the parent layer provided.
|
// the parent layer provided.
|
||||||
func CreateLayer(path, parent string) (err error) {
|
func CreateLayer(ctx context.Context, path, parent string) (err error) {
|
||||||
title := "hcsshim::CreateLayer"
|
title := "hcsshim::CreateLayer"
|
||||||
fields := logrus.Fields{
|
ctx, span := trace.StartSpan(ctx, title)
|
||||||
"parent": parent,
|
defer span.End()
|
||||||
"path": path,
|
defer func() { oc.SetSpanStatus(span, err) }()
|
||||||
}
|
span.AddAttributes(
|
||||||
logrus.WithFields(fields).Debug(title)
|
trace.StringAttribute("path", path),
|
||||||
defer func() {
|
trace.StringAttribute("parent", parent))
|
||||||
if err != nil {
|
|
||||||
fields[logrus.ErrorKey] = err
|
|
||||||
logrus.WithFields(fields).Error(err)
|
|
||||||
} else {
|
|
||||||
logrus.WithFields(fields).Debug(title + " - succeeded")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
err = createLayer(&stdDriverInfo, path, parent)
|
err = createLayer(&stdDriverInfo, path, parent)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
28
vendor/github.com/Microsoft/hcsshim/internal/wclayer/createscratchlayer.go
generated
vendored
28
vendor/github.com/Microsoft/hcsshim/internal/wclayer/createscratchlayer.go
generated
vendored
@ -1,31 +1,29 @@
|
|||||||
package wclayer
|
package wclayer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/Microsoft/hcsshim/internal/hcserror"
|
"github.com/Microsoft/hcsshim/internal/hcserror"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/Microsoft/hcsshim/internal/oc"
|
||||||
|
"go.opencensus.io/trace"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CreateScratchLayer creates and populates new read-write layer for use by a container.
|
// CreateScratchLayer creates and populates new read-write layer for use by a container.
|
||||||
// This requires both the id of the direct parent layer, as well as the full list
|
// This requires both the id of the direct parent layer, as well as the full list
|
||||||
// of paths to all parent layers up to the base (and including the direct parent
|
// of paths to all parent layers up to the base (and including the direct parent
|
||||||
// whose id was provided).
|
// whose id was provided).
|
||||||
func CreateScratchLayer(path string, parentLayerPaths []string) (err error) {
|
func CreateScratchLayer(ctx context.Context, path string, parentLayerPaths []string) (err error) {
|
||||||
title := "hcsshim::CreateScratchLayer"
|
title := "hcsshim::CreateScratchLayer"
|
||||||
fields := logrus.Fields{
|
ctx, span := trace.StartSpan(ctx, title)
|
||||||
"path": path,
|
defer span.End()
|
||||||
}
|
defer func() { oc.SetSpanStatus(span, err) }()
|
||||||
logrus.WithFields(fields).Debug(title)
|
span.AddAttributes(
|
||||||
defer func() {
|
trace.StringAttribute("path", path),
|
||||||
if err != nil {
|
trace.StringAttribute("parentLayerPaths", strings.Join(parentLayerPaths, ", ")))
|
||||||
fields[logrus.ErrorKey] = err
|
|
||||||
logrus.WithFields(fields).Error(err)
|
|
||||||
} else {
|
|
||||||
logrus.WithFields(fields).Debug(title + " - succeeded")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
// Generate layer descriptors
|
// Generate layer descriptors
|
||||||
layers, err := layerPathsToDescriptors(parentLayerPaths)
|
layers, err := layerPathsToDescriptors(ctx, parentLayerPaths)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
23
vendor/github.com/Microsoft/hcsshim/internal/wclayer/deactivatelayer.go
generated
vendored
23
vendor/github.com/Microsoft/hcsshim/internal/wclayer/deactivatelayer.go
generated
vendored
@ -1,25 +1,20 @@
|
|||||||
package wclayer
|
package wclayer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
"github.com/Microsoft/hcsshim/internal/hcserror"
|
"github.com/Microsoft/hcsshim/internal/hcserror"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/Microsoft/hcsshim/internal/oc"
|
||||||
|
"go.opencensus.io/trace"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DeactivateLayer will dismount a layer that was mounted via ActivateLayer.
|
// DeactivateLayer will dismount a layer that was mounted via ActivateLayer.
|
||||||
func DeactivateLayer(path string) (err error) {
|
func DeactivateLayer(ctx context.Context, path string) (err error) {
|
||||||
title := "hcsshim::DeactivateLayer"
|
title := "hcsshim::DeactivateLayer"
|
||||||
fields := logrus.Fields{
|
ctx, span := trace.StartSpan(ctx, title)
|
||||||
"path": path,
|
defer span.End()
|
||||||
}
|
defer func() { oc.SetSpanStatus(span, err) }()
|
||||||
logrus.WithFields(fields).Debug(title)
|
span.AddAttributes(trace.StringAttribute("path", path))
|
||||||
defer func() {
|
|
||||||
if err != nil {
|
|
||||||
fields[logrus.ErrorKey] = err
|
|
||||||
logrus.WithFields(fields).Error(err)
|
|
||||||
} else {
|
|
||||||
logrus.WithFields(fields).Debug(title + " - succeeded")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
err = deactivateLayer(&stdDriverInfo, path)
|
err = deactivateLayer(&stdDriverInfo, path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
23
vendor/github.com/Microsoft/hcsshim/internal/wclayer/destroylayer.go
generated
vendored
23
vendor/github.com/Microsoft/hcsshim/internal/wclayer/destroylayer.go
generated
vendored
@ -1,26 +1,21 @@
|
|||||||
package wclayer
|
package wclayer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
"github.com/Microsoft/hcsshim/internal/hcserror"
|
"github.com/Microsoft/hcsshim/internal/hcserror"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/Microsoft/hcsshim/internal/oc"
|
||||||
|
"go.opencensus.io/trace"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DestroyLayer will remove the on-disk files representing the layer with the given
|
// DestroyLayer will remove the on-disk files representing the layer with the given
|
||||||
// path, including that layer's containing folder, if any.
|
// path, including that layer's containing folder, if any.
|
||||||
func DestroyLayer(path string) (err error) {
|
func DestroyLayer(ctx context.Context, path string) (err error) {
|
||||||
title := "hcsshim::DestroyLayer"
|
title := "hcsshim::DestroyLayer"
|
||||||
fields := logrus.Fields{
|
ctx, span := trace.StartSpan(ctx, title)
|
||||||
"path": path,
|
defer span.End()
|
||||||
}
|
defer func() { oc.SetSpanStatus(span, err) }()
|
||||||
logrus.WithFields(fields).Debug(title)
|
span.AddAttributes(trace.StringAttribute("path", path))
|
||||||
defer func() {
|
|
||||||
if err != nil {
|
|
||||||
fields[logrus.ErrorKey] = err
|
|
||||||
logrus.WithFields(fields).Error(err)
|
|
||||||
} else {
|
|
||||||
logrus.WithFields(fields).Debug(title + " - succeeded")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
err = destroyLayer(&stdDriverInfo, path)
|
err = destroyLayer(&stdDriverInfo, path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
31
vendor/github.com/Microsoft/hcsshim/internal/wclayer/expandscratchsize.go
generated
vendored
31
vendor/github.com/Microsoft/hcsshim/internal/wclayer/expandscratchsize.go
generated
vendored
@ -1,32 +1,27 @@
|
|||||||
package wclayer
|
package wclayer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
"github.com/Microsoft/hcsshim/internal/hcserror"
|
"github.com/Microsoft/hcsshim/internal/hcserror"
|
||||||
|
"github.com/Microsoft/hcsshim/internal/oc"
|
||||||
"github.com/Microsoft/hcsshim/osversion"
|
"github.com/Microsoft/hcsshim/osversion"
|
||||||
"github.com/sirupsen/logrus"
|
"go.opencensus.io/trace"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ExpandScratchSize expands the size of a layer to at least size bytes.
|
// ExpandScratchSize expands the size of a layer to at least size bytes.
|
||||||
func ExpandScratchSize(path string, size uint64) (err error) {
|
func ExpandScratchSize(ctx context.Context, path string, size uint64) (err error) {
|
||||||
title := "hcsshim::ExpandScratchSize"
|
title := "hcsshim::ExpandScratchSize"
|
||||||
fields := logrus.Fields{
|
ctx, span := trace.StartSpan(ctx, title)
|
||||||
"path": path,
|
defer span.End()
|
||||||
"size": size,
|
defer func() { oc.SetSpanStatus(span, err) }()
|
||||||
}
|
span.AddAttributes(
|
||||||
logrus.WithFields(fields).Debug(title)
|
trace.StringAttribute("path", path),
|
||||||
defer func() {
|
trace.Int64Attribute("size", int64(size)))
|
||||||
if err != nil {
|
|
||||||
fields[logrus.ErrorKey] = err
|
|
||||||
logrus.WithFields(fields).Error(err)
|
|
||||||
} else {
|
|
||||||
logrus.WithFields(fields).Debug(title + " - succeeded")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
err = expandSandboxSize(&stdDriverInfo, path, size)
|
err = expandSandboxSize(&stdDriverInfo, path, size)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -36,7 +31,7 @@ func ExpandScratchSize(path string, size uint64) (err error) {
|
|||||||
// Manually expand the volume now in order to work around bugs in 19H1 and
|
// Manually expand the volume now in order to work around bugs in 19H1 and
|
||||||
// prerelease versions of Vb. Remove once this is fixed in Windows.
|
// prerelease versions of Vb. Remove once this is fixed in Windows.
|
||||||
if build := osversion.Get().Build; build >= osversion.V19H1 && build < 19020 {
|
if build := osversion.Get().Build; build >= osversion.V19H1 && build < 19020 {
|
||||||
err = expandSandboxVolume(path)
|
err = expandSandboxVolume(ctx, path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -84,7 +79,7 @@ func attachVhd(path string) (syscall.Handle, error) {
|
|||||||
return handle, nil
|
return handle, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func expandSandboxVolume(path string) error {
|
func expandSandboxVolume(ctx context.Context, path string) error {
|
||||||
// Mount the sandbox VHD temporarily.
|
// Mount the sandbox VHD temporarily.
|
||||||
vhdPath := filepath.Join(path, "sandbox.vhdx")
|
vhdPath := filepath.Join(path, "sandbox.vhdx")
|
||||||
vhd, err := attachVhd(vhdPath)
|
vhd, err := attachVhd(vhdPath)
|
||||||
@ -94,7 +89,7 @@ func expandSandboxVolume(path string) error {
|
|||||||
defer syscall.Close(vhd)
|
defer syscall.Close(vhd)
|
||||||
|
|
||||||
// Open the volume.
|
// Open the volume.
|
||||||
volumePath, err := GetLayerMountPath(path)
|
volumePath, err := GetLayerMountPath(ctx, path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
60
vendor/github.com/Microsoft/hcsshim/internal/wclayer/exportlayer.go
generated
vendored
60
vendor/github.com/Microsoft/hcsshim/internal/wclayer/exportlayer.go
generated
vendored
@ -1,12 +1,15 @@
|
|||||||
package wclayer
|
package wclayer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/Microsoft/go-winio"
|
"github.com/Microsoft/go-winio"
|
||||||
"github.com/Microsoft/hcsshim/internal/hcserror"
|
"github.com/Microsoft/hcsshim/internal/hcserror"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/Microsoft/hcsshim/internal/oc"
|
||||||
|
"go.opencensus.io/trace"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ExportLayer will create a folder at exportFolderPath and fill that folder with
|
// ExportLayer will create a folder at exportFolderPath and fill that folder with
|
||||||
@ -14,24 +17,18 @@ import (
|
|||||||
// format includes any metadata required for later importing the layer (using
|
// format includes any metadata required for later importing the layer (using
|
||||||
// ImportLayer), and requires the full list of parent layer paths in order to
|
// ImportLayer), and requires the full list of parent layer paths in order to
|
||||||
// perform the export.
|
// perform the export.
|
||||||
func ExportLayer(path string, exportFolderPath string, parentLayerPaths []string) (err error) {
|
func ExportLayer(ctx context.Context, path string, exportFolderPath string, parentLayerPaths []string) (err error) {
|
||||||
title := "hcsshim::ExportLayer"
|
title := "hcsshim::ExportLayer"
|
||||||
fields := logrus.Fields{
|
ctx, span := trace.StartSpan(ctx, title)
|
||||||
"path": path,
|
defer span.End()
|
||||||
"exportFolderPath": exportFolderPath,
|
defer func() { oc.SetSpanStatus(span, err) }()
|
||||||
}
|
span.AddAttributes(
|
||||||
logrus.WithFields(fields).Debug(title)
|
trace.StringAttribute("path", path),
|
||||||
defer func() {
|
trace.StringAttribute("exportFolderPath", exportFolderPath),
|
||||||
if err != nil {
|
trace.StringAttribute("parentLayerPaths", strings.Join(parentLayerPaths, ", ")))
|
||||||
fields[logrus.ErrorKey] = err
|
|
||||||
logrus.WithFields(fields).Error(err)
|
|
||||||
} else {
|
|
||||||
logrus.WithFields(fields).Debug(title + " - succeeded")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
// Generate layer descriptors
|
// Generate layer descriptors
|
||||||
layers, err := layerPathsToDescriptors(parentLayerPaths)
|
layers, err := layerPathsToDescriptors(ctx, parentLayerPaths)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -52,25 +49,46 @@ type LayerReader interface {
|
|||||||
// NewLayerReader returns a new layer reader for reading the contents of an on-disk layer.
|
// NewLayerReader returns a new layer reader for reading the contents of an on-disk layer.
|
||||||
// The caller must have taken the SeBackupPrivilege privilege
|
// The caller must have taken the SeBackupPrivilege privilege
|
||||||
// to call this and any methods on the resulting LayerReader.
|
// to call this and any methods on the resulting LayerReader.
|
||||||
func NewLayerReader(path string, parentLayerPaths []string) (LayerReader, error) {
|
func NewLayerReader(ctx context.Context, path string, parentLayerPaths []string) (_ LayerReader, err error) {
|
||||||
|
ctx, span := trace.StartSpan(ctx, "hcsshim::NewLayerReader")
|
||||||
|
defer func() {
|
||||||
|
if err != nil {
|
||||||
|
oc.SetSpanStatus(span, err)
|
||||||
|
span.End()
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
span.AddAttributes(
|
||||||
|
trace.StringAttribute("path", path),
|
||||||
|
trace.StringAttribute("parentLayerPaths", strings.Join(parentLayerPaths, ", ")))
|
||||||
|
|
||||||
exportPath, err := ioutil.TempDir("", "hcs")
|
exportPath, err := ioutil.TempDir("", "hcs")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
err = ExportLayer(path, exportPath, parentLayerPaths)
|
err = ExportLayer(ctx, path, exportPath, parentLayerPaths)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
os.RemoveAll(exportPath)
|
os.RemoveAll(exportPath)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &legacyLayerReaderWrapper{newLegacyLayerReader(exportPath)}, nil
|
return &legacyLayerReaderWrapper{
|
||||||
|
ctx: ctx,
|
||||||
|
s: span,
|
||||||
|
legacyLayerReader: newLegacyLayerReader(exportPath),
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type legacyLayerReaderWrapper struct {
|
type legacyLayerReaderWrapper struct {
|
||||||
|
ctx context.Context
|
||||||
|
s *trace.Span
|
||||||
|
|
||||||
*legacyLayerReader
|
*legacyLayerReader
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *legacyLayerReaderWrapper) Close() error {
|
func (r *legacyLayerReaderWrapper) Close() (err error) {
|
||||||
err := r.legacyLayerReader.Close()
|
defer r.s.End()
|
||||||
|
defer func() { oc.SetSpanStatus(r.s, err) }()
|
||||||
|
|
||||||
|
err = r.legacyLayerReader.Close()
|
||||||
os.RemoveAll(r.root)
|
os.RemoveAll(r.root)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
29
vendor/github.com/Microsoft/hcsshim/internal/wclayer/getlayermountpath.go
generated
vendored
29
vendor/github.com/Microsoft/hcsshim/internal/wclayer/getlayermountpath.go
generated
vendored
@ -1,36 +1,31 @@
|
|||||||
package wclayer
|
package wclayer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/Microsoft/hcsshim/internal/hcserror"
|
"github.com/Microsoft/hcsshim/internal/hcserror"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/Microsoft/hcsshim/internal/log"
|
||||||
|
"github.com/Microsoft/hcsshim/internal/oc"
|
||||||
|
"go.opencensus.io/trace"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetLayerMountPath will look for a mounted layer with the given path and return
|
// GetLayerMountPath will look for a mounted layer with the given path and return
|
||||||
// the path at which that layer can be accessed. This path may be a volume path
|
// the path at which that layer can be accessed. This path may be a volume path
|
||||||
// if the layer is a mounted read-write layer, otherwise it is expected to be the
|
// if the layer is a mounted read-write layer, otherwise it is expected to be the
|
||||||
// folder path at which the layer is stored.
|
// folder path at which the layer is stored.
|
||||||
func GetLayerMountPath(path string) (_ string, err error) {
|
func GetLayerMountPath(ctx context.Context, path string) (_ string, err error) {
|
||||||
title := "hcsshim::GetLayerMountPath"
|
title := "hcsshim::GetLayerMountPath"
|
||||||
fields := logrus.Fields{
|
ctx, span := trace.StartSpan(ctx, title)
|
||||||
"path": path,
|
defer span.End()
|
||||||
}
|
defer func() { oc.SetSpanStatus(span, err) }()
|
||||||
logrus.WithFields(fields).Debug(title)
|
span.AddAttributes(trace.StringAttribute("path", path))
|
||||||
defer func() {
|
|
||||||
if err != nil {
|
|
||||||
fields[logrus.ErrorKey] = err
|
|
||||||
logrus.WithFields(fields).Error(err)
|
|
||||||
} else {
|
|
||||||
logrus.WithFields(fields).Debug(title + " - succeeded")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
var mountPathLength uintptr
|
var mountPathLength uintptr
|
||||||
mountPathLength = 0
|
mountPathLength = 0
|
||||||
|
|
||||||
// Call the procedure itself.
|
// Call the procedure itself.
|
||||||
logrus.WithFields(fields).Debug("Calling proc (1)")
|
log.G(ctx).Debug("Calling proc (1)")
|
||||||
err = getLayerMountPath(&stdDriverInfo, path, &mountPathLength, nil)
|
err = getLayerMountPath(&stdDriverInfo, path, &mountPathLength, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", hcserror.New(err, title+" - failed", "(first call)")
|
return "", hcserror.New(err, title+" - failed", "(first call)")
|
||||||
@ -44,13 +39,13 @@ func GetLayerMountPath(path string) (_ string, err error) {
|
|||||||
mountPathp[0] = 0
|
mountPathp[0] = 0
|
||||||
|
|
||||||
// Call the procedure again
|
// Call the procedure again
|
||||||
logrus.WithFields(fields).Debug("Calling proc (2)")
|
log.G(ctx).Debug("Calling proc (2)")
|
||||||
err = getLayerMountPath(&stdDriverInfo, path, &mountPathLength, &mountPathp[0])
|
err = getLayerMountPath(&stdDriverInfo, path, &mountPathLength, &mountPathp[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", hcserror.New(err, title+" - failed", "(second call)")
|
return "", hcserror.New(err, title+" - failed", "(second call)")
|
||||||
}
|
}
|
||||||
|
|
||||||
mountPath := syscall.UTF16ToString(mountPathp[0:])
|
mountPath := syscall.UTF16ToString(mountPathp[0:])
|
||||||
fields["mountPath"] = mountPath
|
span.AddAttributes(trace.StringAttribute("mountPath", mountPath))
|
||||||
return mountPath, nil
|
return mountPath, nil
|
||||||
}
|
}
|
||||||
|
22
vendor/github.com/Microsoft/hcsshim/internal/wclayer/getsharedbaseimages.go
generated
vendored
22
vendor/github.com/Microsoft/hcsshim/internal/wclayer/getsharedbaseimages.go
generated
vendored
@ -1,29 +1,29 @@
|
|||||||
package wclayer
|
package wclayer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
"github.com/Microsoft/hcsshim/internal/hcserror"
|
"github.com/Microsoft/hcsshim/internal/hcserror"
|
||||||
"github.com/Microsoft/hcsshim/internal/interop"
|
"github.com/Microsoft/hcsshim/internal/interop"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/Microsoft/hcsshim/internal/oc"
|
||||||
|
"go.opencensus.io/trace"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetSharedBaseImages will enumerate the images stored in the common central
|
// GetSharedBaseImages will enumerate the images stored in the common central
|
||||||
// image store and return descriptive info about those images for the purpose
|
// image store and return descriptive info about those images for the purpose
|
||||||
// of registering them with the graphdriver, graph, and tagstore.
|
// of registering them with the graphdriver, graph, and tagstore.
|
||||||
func GetSharedBaseImages() (imageData string, err error) {
|
func GetSharedBaseImages(ctx context.Context) (_ string, err error) {
|
||||||
title := "hcsshim::GetSharedBaseImages"
|
title := "hcsshim::GetSharedBaseImages"
|
||||||
logrus.Debug(title)
|
ctx, span := trace.StartSpan(ctx, title)
|
||||||
defer func() {
|
defer span.End()
|
||||||
if err != nil {
|
defer func() { oc.SetSpanStatus(span, err) }()
|
||||||
logrus.WithError(err).Error(err)
|
|
||||||
} else {
|
|
||||||
logrus.WithField("imageData", imageData).Debug(title + " - succeeded")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
var buffer *uint16
|
var buffer *uint16
|
||||||
err = getBaseImages(&buffer)
|
err = getBaseImages(&buffer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", hcserror.New(err, title+" - failed", "")
|
return "", hcserror.New(err, title+" - failed", "")
|
||||||
}
|
}
|
||||||
return interop.ConvertAndFreeCoTaskMemString(buffer), nil
|
imageData := interop.ConvertAndFreeCoTaskMemString(buffer)
|
||||||
|
span.AddAttributes(trace.StringAttribute("imageData", imageData))
|
||||||
|
return imageData, nil
|
||||||
}
|
}
|
||||||
|
26
vendor/github.com/Microsoft/hcsshim/internal/wclayer/grantvmaccess.go
generated
vendored
26
vendor/github.com/Microsoft/hcsshim/internal/wclayer/grantvmaccess.go
generated
vendored
@ -1,26 +1,22 @@
|
|||||||
package wclayer
|
package wclayer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
"github.com/Microsoft/hcsshim/internal/hcserror"
|
"github.com/Microsoft/hcsshim/internal/hcserror"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/Microsoft/hcsshim/internal/oc"
|
||||||
|
"go.opencensus.io/trace"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GrantVmAccess adds access to a file for a given VM
|
// GrantVmAccess adds access to a file for a given VM
|
||||||
func GrantVmAccess(vmid string, filepath string) (err error) {
|
func GrantVmAccess(ctx context.Context, vmid string, filepath string) (err error) {
|
||||||
title := "hcsshim::GrantVmAccess"
|
title := "hcsshim::GrantVmAccess"
|
||||||
fields := logrus.Fields{
|
ctx, span := trace.StartSpan(ctx, title)
|
||||||
"vm-id": vmid,
|
defer span.End()
|
||||||
"path": filepath,
|
defer func() { oc.SetSpanStatus(span, err) }()
|
||||||
}
|
span.AddAttributes(
|
||||||
logrus.WithFields(fields).Debug(title)
|
trace.StringAttribute("vm-id", vmid),
|
||||||
defer func() {
|
trace.StringAttribute("path", filepath))
|
||||||
if err != nil {
|
|
||||||
fields[logrus.ErrorKey] = err
|
|
||||||
logrus.WithFields(fields).Error(err)
|
|
||||||
} else {
|
|
||||||
logrus.WithFields(fields).Debug(title + " - succeeded")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
err = grantVmAccess(vmid, filepath)
|
err = grantVmAccess(vmid, filepath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
60
vendor/github.com/Microsoft/hcsshim/internal/wclayer/importlayer.go
generated
vendored
60
vendor/github.com/Microsoft/hcsshim/internal/wclayer/importlayer.go
generated
vendored
@ -1,38 +1,35 @@
|
|||||||
package wclayer
|
package wclayer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/Microsoft/go-winio"
|
"github.com/Microsoft/go-winio"
|
||||||
"github.com/Microsoft/hcsshim/internal/hcserror"
|
"github.com/Microsoft/hcsshim/internal/hcserror"
|
||||||
|
"github.com/Microsoft/hcsshim/internal/oc"
|
||||||
"github.com/Microsoft/hcsshim/internal/safefile"
|
"github.com/Microsoft/hcsshim/internal/safefile"
|
||||||
"github.com/sirupsen/logrus"
|
"go.opencensus.io/trace"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ImportLayer will take the contents of the folder at importFolderPath and import
|
// ImportLayer will take the contents of the folder at importFolderPath and import
|
||||||
// that into a layer with the id layerId. Note that in order to correctly populate
|
// that into a layer with the id layerId. Note that in order to correctly populate
|
||||||
// the layer and interperet the transport format, all parent layers must already
|
// the layer and interperet the transport format, all parent layers must already
|
||||||
// be present on the system at the paths provided in parentLayerPaths.
|
// be present on the system at the paths provided in parentLayerPaths.
|
||||||
func ImportLayer(path string, importFolderPath string, parentLayerPaths []string) (err error) {
|
func ImportLayer(ctx context.Context, path string, importFolderPath string, parentLayerPaths []string) (err error) {
|
||||||
title := "hcsshim::ImportLayer"
|
title := "hcsshim::ImportLayer"
|
||||||
fields := logrus.Fields{
|
ctx, span := trace.StartSpan(ctx, title)
|
||||||
"path": path,
|
defer span.End()
|
||||||
"importFolderPath": importFolderPath,
|
defer func() { oc.SetSpanStatus(span, err) }()
|
||||||
}
|
span.AddAttributes(
|
||||||
logrus.WithFields(fields).Debug(title)
|
trace.StringAttribute("path", path),
|
||||||
defer func() {
|
trace.StringAttribute("importFolderPath", importFolderPath),
|
||||||
if err != nil {
|
trace.StringAttribute("parentLayerPaths", strings.Join(parentLayerPaths, ", ")))
|
||||||
fields[logrus.ErrorKey] = err
|
|
||||||
logrus.WithFields(fields).Error(err)
|
|
||||||
} else {
|
|
||||||
logrus.WithFields(fields).Debug(title + " - succeeded")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
// Generate layer descriptors
|
// Generate layer descriptors
|
||||||
layers, err := layerPathsToDescriptors(parentLayerPaths)
|
layers, err := layerPathsToDescriptors(ctx, parentLayerPaths)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -60,20 +57,26 @@ type LayerWriter interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type legacyLayerWriterWrapper struct {
|
type legacyLayerWriterWrapper struct {
|
||||||
|
ctx context.Context
|
||||||
|
s *trace.Span
|
||||||
|
|
||||||
*legacyLayerWriter
|
*legacyLayerWriter
|
||||||
path string
|
path string
|
||||||
parentLayerPaths []string
|
parentLayerPaths []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *legacyLayerWriterWrapper) Close() error {
|
func (r *legacyLayerWriterWrapper) Close() (err error) {
|
||||||
|
defer r.s.End()
|
||||||
|
defer func() { oc.SetSpanStatus(r.s, err) }()
|
||||||
defer os.RemoveAll(r.root.Name())
|
defer os.RemoveAll(r.root.Name())
|
||||||
defer r.legacyLayerWriter.CloseRoots()
|
defer r.legacyLayerWriter.CloseRoots()
|
||||||
err := r.legacyLayerWriter.Close()
|
|
||||||
|
err = r.legacyLayerWriter.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = ImportLayer(r.destRoot.Name(), r.path, r.parentLayerPaths); err != nil {
|
if err = ImportLayer(r.ctx, r.destRoot.Name(), r.path, r.parentLayerPaths); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
for _, name := range r.Tombstones {
|
for _, name := range r.Tombstones {
|
||||||
@ -96,7 +99,7 @@ func (r *legacyLayerWriterWrapper) Close() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = ProcessUtilityVMImage(filepath.Join(r.destRoot.Name(), "UtilityVM"))
|
err = ProcessUtilityVMImage(r.ctx, filepath.Join(r.destRoot.Name(), "UtilityVM"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -107,7 +110,18 @@ func (r *legacyLayerWriterWrapper) Close() error {
|
|||||||
// NewLayerWriter returns a new layer writer for creating a layer on disk.
|
// NewLayerWriter returns a new layer writer for creating a layer on disk.
|
||||||
// The caller must have taken the SeBackupPrivilege and SeRestorePrivilege privileges
|
// The caller must have taken the SeBackupPrivilege and SeRestorePrivilege privileges
|
||||||
// to call this and any methods on the resulting LayerWriter.
|
// to call this and any methods on the resulting LayerWriter.
|
||||||
func NewLayerWriter(path string, parentLayerPaths []string) (LayerWriter, error) {
|
func NewLayerWriter(ctx context.Context, path string, parentLayerPaths []string) (_ LayerWriter, err error) {
|
||||||
|
ctx, span := trace.StartSpan(ctx, "hcsshim::NewLayerWriter")
|
||||||
|
defer func() {
|
||||||
|
if err != nil {
|
||||||
|
oc.SetSpanStatus(span, err)
|
||||||
|
span.End()
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
span.AddAttributes(
|
||||||
|
trace.StringAttribute("path", path),
|
||||||
|
trace.StringAttribute("parentLayerPaths", strings.Join(parentLayerPaths, ", ")))
|
||||||
|
|
||||||
if len(parentLayerPaths) == 0 {
|
if len(parentLayerPaths) == 0 {
|
||||||
// This is a base layer. It gets imported differently.
|
// This is a base layer. It gets imported differently.
|
||||||
f, err := safefile.OpenRoot(path)
|
f, err := safefile.OpenRoot(path)
|
||||||
@ -115,6 +129,8 @@ func NewLayerWriter(path string, parentLayerPaths []string) (LayerWriter, error)
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &baseLayerWriter{
|
return &baseLayerWriter{
|
||||||
|
ctx: ctx,
|
||||||
|
s: span,
|
||||||
root: f,
|
root: f,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
@ -128,6 +144,8 @@ func NewLayerWriter(path string, parentLayerPaths []string) (LayerWriter, error)
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &legacyLayerWriterWrapper{
|
return &legacyLayerWriterWrapper{
|
||||||
|
ctx: ctx,
|
||||||
|
s: span,
|
||||||
legacyLayerWriter: w,
|
legacyLayerWriter: w,
|
||||||
path: importPath,
|
path: importPath,
|
||||||
parentLayerPaths: parentLayerPaths,
|
parentLayerPaths: parentLayerPaths,
|
||||||
|
25
vendor/github.com/Microsoft/hcsshim/internal/wclayer/layerexists.go
generated
vendored
25
vendor/github.com/Microsoft/hcsshim/internal/wclayer/layerexists.go
generated
vendored
@ -1,26 +1,21 @@
|
|||||||
package wclayer
|
package wclayer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
"github.com/Microsoft/hcsshim/internal/hcserror"
|
"github.com/Microsoft/hcsshim/internal/hcserror"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/Microsoft/hcsshim/internal/oc"
|
||||||
|
"go.opencensus.io/trace"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LayerExists will return true if a layer with the given id exists and is known
|
// LayerExists will return true if a layer with the given id exists and is known
|
||||||
// to the system.
|
// to the system.
|
||||||
func LayerExists(path string) (_ bool, err error) {
|
func LayerExists(ctx context.Context, path string) (_ bool, err error) {
|
||||||
title := "hcsshim::LayerExists"
|
title := "hcsshim::LayerExists"
|
||||||
fields := logrus.Fields{
|
ctx, span := trace.StartSpan(ctx, title)
|
||||||
"path": path,
|
defer span.End()
|
||||||
}
|
defer func() { oc.SetSpanStatus(span, err) }()
|
||||||
logrus.WithFields(fields).Debug(title)
|
span.AddAttributes(trace.StringAttribute("path", path))
|
||||||
defer func() {
|
|
||||||
if err != nil {
|
|
||||||
fields[logrus.ErrorKey] = err
|
|
||||||
logrus.WithFields(fields).Error(err)
|
|
||||||
} else {
|
|
||||||
logrus.WithFields(fields).Debug(title + " - succeeded")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
// Call the procedure itself.
|
// Call the procedure itself.
|
||||||
var exists uint32
|
var exists uint32
|
||||||
@ -28,6 +23,6 @@ func LayerExists(path string) (_ bool, err error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return false, hcserror.New(err, title+" - failed", "")
|
return false, hcserror.New(err, title+" - failed", "")
|
||||||
}
|
}
|
||||||
fields["layer-exists"] = exists != 0
|
span.AddAttributes(trace.BoolAttribute("layer-exists", exists != 0))
|
||||||
return exists != 0, nil
|
return exists != 0, nil
|
||||||
}
|
}
|
||||||
|
13
vendor/github.com/Microsoft/hcsshim/internal/wclayer/layerid.go
generated
vendored
13
vendor/github.com/Microsoft/hcsshim/internal/wclayer/layerid.go
generated
vendored
@ -1,13 +1,22 @@
|
|||||||
package wclayer
|
package wclayer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/Microsoft/go-winio/pkg/guid"
|
"github.com/Microsoft/go-winio/pkg/guid"
|
||||||
|
"github.com/Microsoft/hcsshim/internal/oc"
|
||||||
|
"go.opencensus.io/trace"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LayerID returns the layer ID of a layer on disk.
|
// LayerID returns the layer ID of a layer on disk.
|
||||||
func LayerID(path string) (guid.GUID, error) {
|
func LayerID(ctx context.Context, path string) (_ guid.GUID, err error) {
|
||||||
|
title := "hcsshim::LayerID"
|
||||||
|
ctx, span := trace.StartSpan(ctx, title)
|
||||||
|
defer span.End()
|
||||||
|
defer func() { oc.SetSpanStatus(span, err) }()
|
||||||
|
span.AddAttributes(trace.StringAttribute("path", path))
|
||||||
|
|
||||||
_, file := filepath.Split(path)
|
_, file := filepath.Split(path)
|
||||||
return NameToGuid(file)
|
return NameToGuid(ctx, file)
|
||||||
}
|
}
|
||||||
|
5
vendor/github.com/Microsoft/hcsshim/internal/wclayer/layerutils.go
generated
vendored
5
vendor/github.com/Microsoft/hcsshim/internal/wclayer/layerutils.go
generated
vendored
@ -4,6 +4,7 @@ package wclayer
|
|||||||
// functionality.
|
// functionality.
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/Microsoft/go-winio/pkg/guid"
|
"github.com/Microsoft/go-winio/pkg/guid"
|
||||||
@ -68,12 +69,12 @@ type WC_LAYER_DESCRIPTOR struct {
|
|||||||
Pathp *uint16
|
Pathp *uint16
|
||||||
}
|
}
|
||||||
|
|
||||||
func layerPathsToDescriptors(parentLayerPaths []string) ([]WC_LAYER_DESCRIPTOR, error) {
|
func layerPathsToDescriptors(ctx context.Context, parentLayerPaths []string) ([]WC_LAYER_DESCRIPTOR, error) {
|
||||||
// Array of descriptors that gets constructed.
|
// Array of descriptors that gets constructed.
|
||||||
var layers []WC_LAYER_DESCRIPTOR
|
var layers []WC_LAYER_DESCRIPTOR
|
||||||
|
|
||||||
for i := 0; i < len(parentLayerPaths); i++ {
|
for i := 0; i < len(parentLayerPaths); i++ {
|
||||||
g, err := LayerID(parentLayerPaths[i])
|
g, err := LayerID(ctx, parentLayerPaths[i])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.WithError(err).Debug("Failed to convert name to guid")
|
logrus.WithError(err).Debug("Failed to convert name to guid")
|
||||||
return nil, err
|
return nil, err
|
||||||
|
31
vendor/github.com/Microsoft/hcsshim/internal/wclayer/nametoguid.go
generated
vendored
31
vendor/github.com/Microsoft/hcsshim/internal/wclayer/nametoguid.go
generated
vendored
@ -1,34 +1,29 @@
|
|||||||
package wclayer
|
package wclayer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
"github.com/Microsoft/go-winio/pkg/guid"
|
"github.com/Microsoft/go-winio/pkg/guid"
|
||||||
"github.com/Microsoft/hcsshim/internal/hcserror"
|
"github.com/Microsoft/hcsshim/internal/hcserror"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/Microsoft/hcsshim/internal/oc"
|
||||||
|
"go.opencensus.io/trace"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NameToGuid converts the given string into a GUID using the algorithm in the
|
// NameToGuid converts the given string into a GUID using the algorithm in the
|
||||||
// Host Compute Service, ensuring GUIDs generated with the same string are common
|
// Host Compute Service, ensuring GUIDs generated with the same string are common
|
||||||
// across all clients.
|
// across all clients.
|
||||||
func NameToGuid(name string) (id guid.GUID, err error) {
|
func NameToGuid(ctx context.Context, name string) (_ guid.GUID, err error) {
|
||||||
title := "hcsshim::NameToGuid"
|
title := "hcsshim::NameToGuid"
|
||||||
fields := logrus.Fields{
|
ctx, span := trace.StartSpan(ctx, title)
|
||||||
"name": name,
|
defer span.End()
|
||||||
}
|
defer func() { oc.SetSpanStatus(span, err) }()
|
||||||
logrus.WithFields(fields).Debug(title)
|
span.AddAttributes(trace.StringAttribute("name", name))
|
||||||
defer func() {
|
|
||||||
if err != nil {
|
|
||||||
fields[logrus.ErrorKey] = err
|
|
||||||
logrus.WithFields(fields).Error(err)
|
|
||||||
} else {
|
|
||||||
logrus.WithFields(fields).Debug(title + " - succeeded")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
|
var id guid.GUID
|
||||||
err = nameToGuid(name, &id)
|
err = nameToGuid(name, &id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = hcserror.New(err, title+" - failed", "")
|
return guid.GUID{}, hcserror.New(err, title+" - failed", "")
|
||||||
return
|
|
||||||
}
|
}
|
||||||
fields["guid"] = id.String()
|
span.AddAttributes(trace.StringAttribute("guid", id.String()))
|
||||||
return
|
return id, nil
|
||||||
}
|
}
|
||||||
|
27
vendor/github.com/Microsoft/hcsshim/internal/wclayer/preparelayer.go
generated
vendored
27
vendor/github.com/Microsoft/hcsshim/internal/wclayer/preparelayer.go
generated
vendored
@ -1,10 +1,13 @@
|
|||||||
package wclayer
|
package wclayer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/Microsoft/hcsshim/internal/hcserror"
|
"github.com/Microsoft/hcsshim/internal/hcserror"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/Microsoft/hcsshim/internal/oc"
|
||||||
|
"go.opencensus.io/trace"
|
||||||
)
|
)
|
||||||
|
|
||||||
var prepareLayerLock sync.Mutex
|
var prepareLayerLock sync.Mutex
|
||||||
@ -14,23 +17,17 @@ var prepareLayerLock sync.Mutex
|
|||||||
// parent layers, and is necessary in order to view or interact with the layer
|
// parent layers, and is necessary in order to view or interact with the layer
|
||||||
// as an actual filesystem (reading and writing files, creating directories, etc).
|
// as an actual filesystem (reading and writing files, creating directories, etc).
|
||||||
// Disabling the filter must be done via UnprepareLayer.
|
// Disabling the filter must be done via UnprepareLayer.
|
||||||
func PrepareLayer(path string, parentLayerPaths []string) (err error) {
|
func PrepareLayer(ctx context.Context, path string, parentLayerPaths []string) (err error) {
|
||||||
title := "hcsshim::PrepareLayer"
|
title := "hcsshim::PrepareLayer"
|
||||||
fields := logrus.Fields{
|
ctx, span := trace.StartSpan(ctx, title)
|
||||||
"path": path,
|
defer span.End()
|
||||||
}
|
defer func() { oc.SetSpanStatus(span, err) }()
|
||||||
logrus.WithFields(fields).Debug(title)
|
span.AddAttributes(
|
||||||
defer func() {
|
trace.StringAttribute("path", path),
|
||||||
if err != nil {
|
trace.StringAttribute("parentLayerPaths", strings.Join(parentLayerPaths, ", ")))
|
||||||
fields[logrus.ErrorKey] = err
|
|
||||||
logrus.WithFields(fields).Error(err)
|
|
||||||
} else {
|
|
||||||
logrus.WithFields(fields).Debug(title + " - succeeded")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
// Generate layer descriptors
|
// Generate layer descriptors
|
||||||
layers, err := layerPathsToDescriptors(parentLayerPaths)
|
layers, err := layerPathsToDescriptors(ctx, parentLayerPaths)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
32
vendor/github.com/Microsoft/hcsshim/internal/wclayer/processimage.go
generated
vendored
32
vendor/github.com/Microsoft/hcsshim/internal/wclayer/processimage.go
generated
vendored
@ -1,23 +1,41 @@
|
|||||||
package wclayer
|
package wclayer
|
||||||
|
|
||||||
import "os"
|
import (
|
||||||
|
"context"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/Microsoft/hcsshim/internal/oc"
|
||||||
|
"go.opencensus.io/trace"
|
||||||
|
)
|
||||||
|
|
||||||
// ProcessBaseLayer post-processes a base layer that has had its files extracted.
|
// ProcessBaseLayer post-processes a base layer that has had its files extracted.
|
||||||
// The files should have been extracted to <path>\Files.
|
// The files should have been extracted to <path>\Files.
|
||||||
func ProcessBaseLayer(path string) error {
|
func ProcessBaseLayer(ctx context.Context, path string) (err error) {
|
||||||
err := processBaseImage(path)
|
title := "hcsshim::ProcessBaseLayer"
|
||||||
|
ctx, span := trace.StartSpan(ctx, title)
|
||||||
|
defer span.End()
|
||||||
|
defer func() { oc.SetSpanStatus(span, err) }()
|
||||||
|
span.AddAttributes(trace.StringAttribute("path", path))
|
||||||
|
|
||||||
|
err = processBaseImage(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &os.PathError{Op: "ProcessBaseLayer", Path: path, Err: err}
|
return &os.PathError{Op: title, Path: path, Err: err}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProcessUtilityVMImage post-processes a utility VM image that has had its files extracted.
|
// ProcessUtilityVMImage post-processes a utility VM image that has had its files extracted.
|
||||||
// The files should have been extracted to <path>\Files.
|
// The files should have been extracted to <path>\Files.
|
||||||
func ProcessUtilityVMImage(path string) error {
|
func ProcessUtilityVMImage(ctx context.Context, path string) (err error) {
|
||||||
err := processUtilityImage(path)
|
title := "hcsshim::ProcessUtilityVMImage"
|
||||||
|
ctx, span := trace.StartSpan(ctx, title)
|
||||||
|
defer span.End()
|
||||||
|
defer func() { oc.SetSpanStatus(span, err) }()
|
||||||
|
span.AddAttributes(trace.StringAttribute("path", path))
|
||||||
|
|
||||||
|
err = processUtilityImage(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &os.PathError{Op: "ProcessUtilityVMImage", Path: path, Err: err}
|
return &os.PathError{Op: title, Path: path, Err: err}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
23
vendor/github.com/Microsoft/hcsshim/internal/wclayer/unpreparelayer.go
generated
vendored
23
vendor/github.com/Microsoft/hcsshim/internal/wclayer/unpreparelayer.go
generated
vendored
@ -1,26 +1,21 @@
|
|||||||
package wclayer
|
package wclayer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
"github.com/Microsoft/hcsshim/internal/hcserror"
|
"github.com/Microsoft/hcsshim/internal/hcserror"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/Microsoft/hcsshim/internal/oc"
|
||||||
|
"go.opencensus.io/trace"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UnprepareLayer disables the filesystem filter for the read-write layer with
|
// UnprepareLayer disables the filesystem filter for the read-write layer with
|
||||||
// the given id.
|
// the given id.
|
||||||
func UnprepareLayer(path string) (err error) {
|
func UnprepareLayer(ctx context.Context, path string) (err error) {
|
||||||
title := "hcsshim::UnprepareLayer"
|
title := "hcsshim::UnprepareLayer"
|
||||||
fields := logrus.Fields{
|
ctx, span := trace.StartSpan(ctx, title)
|
||||||
"path": path,
|
defer span.End()
|
||||||
}
|
defer func() { oc.SetSpanStatus(span, err) }()
|
||||||
logrus.WithFields(fields).Debug(title)
|
span.AddAttributes(trace.StringAttribute("path", path))
|
||||||
defer func() {
|
|
||||||
if err != nil {
|
|
||||||
fields[logrus.ErrorKey] = err
|
|
||||||
logrus.WithFields(fields).Error(err)
|
|
||||||
} else {
|
|
||||||
logrus.WithFields(fields).Debug(title + " - succeeded")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
err = unprepareLayer(&stdDriverInfo, path)
|
err = unprepareLayer(&stdDriverInfo, path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
41
vendor/github.com/Microsoft/hcsshim/layer.go
generated
vendored
41
vendor/github.com/Microsoft/hcsshim/layer.go
generated
vendored
@ -1,6 +1,7 @@
|
|||||||
package hcsshim
|
package hcsshim
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"crypto/sha1"
|
"crypto/sha1"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
@ -13,59 +14,59 @@ func layerPath(info *DriverInfo, id string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ActivateLayer(info DriverInfo, id string) error {
|
func ActivateLayer(info DriverInfo, id string) error {
|
||||||
return wclayer.ActivateLayer(layerPath(&info, id))
|
return wclayer.ActivateLayer(context.Background(), layerPath(&info, id))
|
||||||
}
|
}
|
||||||
func CreateLayer(info DriverInfo, id, parent string) error {
|
func CreateLayer(info DriverInfo, id, parent string) error {
|
||||||
return wclayer.CreateLayer(layerPath(&info, id), parent)
|
return wclayer.CreateLayer(context.Background(), layerPath(&info, id), parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
// New clients should use CreateScratchLayer instead. Kept in to preserve API compatibility.
|
// New clients should use CreateScratchLayer instead. Kept in to preserve API compatibility.
|
||||||
func CreateSandboxLayer(info DriverInfo, layerId, parentId string, parentLayerPaths []string) error {
|
func CreateSandboxLayer(info DriverInfo, layerId, parentId string, parentLayerPaths []string) error {
|
||||||
return wclayer.CreateScratchLayer(layerPath(&info, layerId), parentLayerPaths)
|
return wclayer.CreateScratchLayer(context.Background(), layerPath(&info, layerId), parentLayerPaths)
|
||||||
}
|
}
|
||||||
func CreateScratchLayer(info DriverInfo, layerId, parentId string, parentLayerPaths []string) error {
|
func CreateScratchLayer(info DriverInfo, layerId, parentId string, parentLayerPaths []string) error {
|
||||||
return wclayer.CreateScratchLayer(layerPath(&info, layerId), parentLayerPaths)
|
return wclayer.CreateScratchLayer(context.Background(), layerPath(&info, layerId), parentLayerPaths)
|
||||||
}
|
}
|
||||||
func DeactivateLayer(info DriverInfo, id string) error {
|
func DeactivateLayer(info DriverInfo, id string) error {
|
||||||
return wclayer.DeactivateLayer(layerPath(&info, id))
|
return wclayer.DeactivateLayer(context.Background(), layerPath(&info, id))
|
||||||
}
|
}
|
||||||
func DestroyLayer(info DriverInfo, id string) error {
|
func DestroyLayer(info DriverInfo, id string) error {
|
||||||
return wclayer.DestroyLayer(layerPath(&info, id))
|
return wclayer.DestroyLayer(context.Background(), layerPath(&info, id))
|
||||||
}
|
}
|
||||||
|
|
||||||
// New clients should use ExpandScratchSize instead. Kept in to preserve API compatibility.
|
// New clients should use ExpandScratchSize instead. Kept in to preserve API compatibility.
|
||||||
func ExpandSandboxSize(info DriverInfo, layerId string, size uint64) error {
|
func ExpandSandboxSize(info DriverInfo, layerId string, size uint64) error {
|
||||||
return wclayer.ExpandScratchSize(layerPath(&info, layerId), size)
|
return wclayer.ExpandScratchSize(context.Background(), layerPath(&info, layerId), size)
|
||||||
}
|
}
|
||||||
func ExpandScratchSize(info DriverInfo, layerId string, size uint64) error {
|
func ExpandScratchSize(info DriverInfo, layerId string, size uint64) error {
|
||||||
return wclayer.ExpandScratchSize(layerPath(&info, layerId), size)
|
return wclayer.ExpandScratchSize(context.Background(), layerPath(&info, layerId), size)
|
||||||
}
|
}
|
||||||
func ExportLayer(info DriverInfo, layerId string, exportFolderPath string, parentLayerPaths []string) error {
|
func ExportLayer(info DriverInfo, layerId string, exportFolderPath string, parentLayerPaths []string) error {
|
||||||
return wclayer.ExportLayer(layerPath(&info, layerId), exportFolderPath, parentLayerPaths)
|
return wclayer.ExportLayer(context.Background(), layerPath(&info, layerId), exportFolderPath, parentLayerPaths)
|
||||||
}
|
}
|
||||||
func GetLayerMountPath(info DriverInfo, id string) (string, error) {
|
func GetLayerMountPath(info DriverInfo, id string) (string, error) {
|
||||||
return wclayer.GetLayerMountPath(layerPath(&info, id))
|
return wclayer.GetLayerMountPath(context.Background(), layerPath(&info, id))
|
||||||
}
|
}
|
||||||
func GetSharedBaseImages() (imageData string, err error) {
|
func GetSharedBaseImages() (imageData string, err error) {
|
||||||
return wclayer.GetSharedBaseImages()
|
return wclayer.GetSharedBaseImages(context.Background())
|
||||||
}
|
}
|
||||||
func ImportLayer(info DriverInfo, layerID string, importFolderPath string, parentLayerPaths []string) error {
|
func ImportLayer(info DriverInfo, layerID string, importFolderPath string, parentLayerPaths []string) error {
|
||||||
return wclayer.ImportLayer(layerPath(&info, layerID), importFolderPath, parentLayerPaths)
|
return wclayer.ImportLayer(context.Background(), layerPath(&info, layerID), importFolderPath, parentLayerPaths)
|
||||||
}
|
}
|
||||||
func LayerExists(info DriverInfo, id string) (bool, error) {
|
func LayerExists(info DriverInfo, id string) (bool, error) {
|
||||||
return wclayer.LayerExists(layerPath(&info, id))
|
return wclayer.LayerExists(context.Background(), layerPath(&info, id))
|
||||||
}
|
}
|
||||||
func PrepareLayer(info DriverInfo, layerId string, parentLayerPaths []string) error {
|
func PrepareLayer(info DriverInfo, layerId string, parentLayerPaths []string) error {
|
||||||
return wclayer.PrepareLayer(layerPath(&info, layerId), parentLayerPaths)
|
return wclayer.PrepareLayer(context.Background(), layerPath(&info, layerId), parentLayerPaths)
|
||||||
}
|
}
|
||||||
func ProcessBaseLayer(path string) error {
|
func ProcessBaseLayer(path string) error {
|
||||||
return wclayer.ProcessBaseLayer(path)
|
return wclayer.ProcessBaseLayer(context.Background(), path)
|
||||||
}
|
}
|
||||||
func ProcessUtilityVMImage(path string) error {
|
func ProcessUtilityVMImage(path string) error {
|
||||||
return wclayer.ProcessUtilityVMImage(path)
|
return wclayer.ProcessUtilityVMImage(context.Background(), path)
|
||||||
}
|
}
|
||||||
func UnprepareLayer(info DriverInfo, layerId string) error {
|
func UnprepareLayer(info DriverInfo, layerId string) error {
|
||||||
return wclayer.UnprepareLayer(layerPath(&info, layerId))
|
return wclayer.UnprepareLayer(context.Background(), layerPath(&info, layerId))
|
||||||
}
|
}
|
||||||
|
|
||||||
type DriverInfo struct {
|
type DriverInfo struct {
|
||||||
@ -76,7 +77,7 @@ type DriverInfo struct {
|
|||||||
type GUID [16]byte
|
type GUID [16]byte
|
||||||
|
|
||||||
func NameToGuid(name string) (id GUID, err error) {
|
func NameToGuid(name string) (id GUID, err error) {
|
||||||
g, err := wclayer.NameToGuid(name)
|
g, err := wclayer.NameToGuid(context.Background(), name)
|
||||||
return g.ToWindowsArray(), err
|
return g.ToWindowsArray(), err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,13 +95,13 @@ func (g *GUID) ToString() string {
|
|||||||
type LayerReader = wclayer.LayerReader
|
type LayerReader = wclayer.LayerReader
|
||||||
|
|
||||||
func NewLayerReader(info DriverInfo, layerID string, parentLayerPaths []string) (LayerReader, error) {
|
func NewLayerReader(info DriverInfo, layerID string, parentLayerPaths []string) (LayerReader, error) {
|
||||||
return wclayer.NewLayerReader(layerPath(&info, layerID), parentLayerPaths)
|
return wclayer.NewLayerReader(context.Background(), layerPath(&info, layerID), parentLayerPaths)
|
||||||
}
|
}
|
||||||
|
|
||||||
type LayerWriter = wclayer.LayerWriter
|
type LayerWriter = wclayer.LayerWriter
|
||||||
|
|
||||||
func NewLayerWriter(info DriverInfo, layerID string, parentLayerPaths []string) (LayerWriter, error) {
|
func NewLayerWriter(info DriverInfo, layerID string, parentLayerPaths []string) (LayerWriter, error) {
|
||||||
return wclayer.NewLayerWriter(layerPath(&info, layerID), parentLayerPaths)
|
return wclayer.NewLayerWriter(context.Background(), layerPath(&info, layerID), parentLayerPaths)
|
||||||
}
|
}
|
||||||
|
|
||||||
type WC_LAYER_DESCRIPTOR = wclayer.WC_LAYER_DESCRIPTOR
|
type WC_LAYER_DESCRIPTOR = wclayer.WC_LAYER_DESCRIPTOR
|
||||||
|
Loading…
Reference in New Issue
Block a user