full diff: https://github.com/Microsoft/hcsshim/compare/v0.8.7...v0.8.9
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 08d37743045ce9b4ab477f309eb2e6a18e72384d)
Signed-off-by: Ameya Gawde <agawde@mirantis.com>
| ... | ... |
@@ -1,5 +1,5 @@ |
| 1 | 1 |
github.com/Azure/go-ansiterm d6e3b3328b783f23731bc4d058875b0371ff8109 |
| 2 |
-github.com/Microsoft/hcsshim b3f49c06ffaeef24d09c6c08ec8ec8425a0303e2 |
|
| 2 |
+github.com/Microsoft/hcsshim 5bc557dd210ff2caf615e6e22d398123de77fc11 # v0.8.9 |
|
| 3 | 3 |
github.com/Microsoft/go-winio 6c72808b55902eae4c5943626030429ff20f3b63 # v0.4.14 |
| 4 | 4 |
github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a |
| 5 | 5 |
github.com/golang/gddo 9b12a26f3fbd7397dee4e20939ddca719d840d2a |
| ... | ... |
@@ -2,7 +2,7 @@ |
| 2 | 2 |
|
| 3 | 3 |
[](https://ci.appveyor.com/project/WindowsVirtualization/hcsshim/branch/master) |
| 4 | 4 |
|
| 5 |
-This package contains the Golang interface for using the Windows [Host Compute Service](https://blogs.technet.microsoft.com/virtualization/2017/01/27/introducing-the-host-compute-service-hcs/) (HCS) to launch and manage [Windows Containers](https://docs.microsoft.com/en-us/virtualization/windowscontainers/about/). It also contains other helpers and functions for managing Windows Containers such as the Golang interface for the Host Network Service (HNS). |
|
| 5 |
+This package contains the Golang interface for using the Windows [Host Compute Service](https://techcommunity.microsoft.com/t5/containers/introducing-the-host-compute-service-hcs/ba-p/382332) (HCS) to launch and manage [Windows Containers](https://docs.microsoft.com/en-us/virtualization/windowscontainers/about/). It also contains other helpers and functions for managing Windows Containers such as the Golang interface for the Host Network Service (HNS). |
|
| 6 | 6 |
|
| 7 | 7 |
It is primarily used in the [Moby Project](https://github.com/moby/moby), but it can be freely used by other projects as well. |
| 8 | 8 |
|
| ... | ... |
@@ -16,6 +16,11 @@ When you submit a pull request, a CLA-bot will automatically determine whether y |
| 16 | 16 |
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions |
| 17 | 17 |
provided by the bot. You will only need to do this once across all repos using our CLA. |
| 18 | 18 |
|
| 19 |
+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. |
|
| 20 |
+ |
|
| 21 |
+ |
|
| 22 |
+## Code of Conduct |
|
| 23 |
+ |
|
| 19 | 24 |
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). |
| 20 | 25 |
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or |
| 21 | 26 |
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. |
| ... | ... |
@@ -101,7 +101,21 @@ type Options struct {
|
| 101 | 101 |
SandboxIsolation Options_SandboxIsolation `protobuf:"varint,6,opt,name=sandbox_isolation,json=sandboxIsolation,proto3,enum=containerd.runhcs.v1.Options_SandboxIsolation" json:"sandbox_isolation,omitempty"` |
| 102 | 102 |
// boot_files_root_path is the path to the directory containing the LCOW |
| 103 | 103 |
// kernel and root FS files. |
| 104 |
- BootFilesRootPath string `protobuf:"bytes,7,opt,name=boot_files_root_path,json=bootFilesRootPath,proto3" json:"boot_files_root_path,omitempty"` |
|
| 104 |
+ BootFilesRootPath string `protobuf:"bytes,7,opt,name=boot_files_root_path,json=bootFilesRootPath,proto3" json:"boot_files_root_path,omitempty"` |
|
| 105 |
+ // vm_processor_count is the default number of processors to create for the |
|
| 106 |
+ // hypervisor isolated utility vm. |
|
| 107 |
+ // |
|
| 108 |
+ // The platform default if omitted is 2, unless the host only has a single |
|
| 109 |
+ // core in which case it is 1. |
|
| 110 |
+ VmProcessorCount int32 `protobuf:"varint,8,opt,name=vm_processor_count,json=vmProcessorCount,proto3" json:"vm_processor_count,omitempty"` |
|
| 111 |
+ // vm_memory_size_in_mb is the default amount of memory to assign to the |
|
| 112 |
+ // hypervisor isolated utility vm. |
|
| 113 |
+ // |
|
| 114 |
+ // The platform default is 1024MB if omitted. |
|
| 115 |
+ VmMemorySizeInMb int32 `protobuf:"varint,9,opt,name=vm_memory_size_in_mb,json=vmMemorySizeInMb,proto3" json:"vm_memory_size_in_mb,omitempty"` |
|
| 116 |
+ // GPUVHDPath is the path to the gpu vhd to add to the uvm |
|
| 117 |
+ // when a container requests a gpu |
|
| 118 |
+ GPUVHDPath string `protobuf:"bytes,10,opt,name=GPUVHDPath,json=gPUVHDPath,proto3" json:"GPUVHDPath,omitempty"` |
|
| 105 | 119 |
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
| 106 | 120 |
XXX_unrecognized []byte `json:"-"` |
| 107 | 121 |
XXX_sizecache int32 `json:"-"` |
| ... | ... |
@@ -200,51 +214,56 @@ func init() {
|
| 200 | 200 |
} |
| 201 | 201 |
|
| 202 | 202 |
var fileDescriptor_b643df6839c75082 = []byte{
|
| 203 |
- // 704 bytes of a gzipped FileDescriptorProto |
|
| 204 |
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x4d, 0x6f, 0xda, 0x48, |
|
| 205 |
- 0x18, 0xc6, 0xe1, 0xd3, 0x6f, 0x96, 0xc4, 0x99, 0xe5, 0x80, 0xb2, 0xbb, 0x80, 0xc8, 0x21, 0x89, |
|
| 206 |
- 0x76, 0x63, 0x43, 0xf6, 0xd8, 0x53, 0x09, 0xa0, 0xba, 0x6a, 0x83, 0x65, 0xa2, 0xa6, 0x1f, 0x07, |
|
| 207 |
- 0xcb, 0xd8, 0x83, 0xb1, 0x82, 0x3d, 0xd6, 0xcc, 0x90, 0x86, 0x5b, 0x7f, 0x42, 0x7f, 0x55, 0x95, |
|
| 208 |
- 0x63, 0x8f, 0x95, 0x2a, 0xa5, 0x0d, 0xbf, 0xa4, 0x9a, 0xb1, 0x49, 0xd4, 0x28, 0xea, 0xa5, 0x27, |
|
| 209 |
- 0xc6, 0xcf, 0xf3, 0xbc, 0xcf, 0xfb, 0x29, 0x60, 0x14, 0x84, 0x7c, 0xb6, 0x98, 0xe8, 0x1e, 0x89, |
|
| 210 |
- 0x8c, 0x97, 0xa1, 0x47, 0x09, 0x23, 0x53, 0x6e, 0xcc, 0x3c, 0xc6, 0x66, 0x61, 0x64, 0x78, 0x91, |
|
| 211 |
- 0x6f, 0x78, 0x24, 0xe6, 0x6e, 0x18, 0x63, 0xea, 0x1f, 0x09, 0xec, 0x88, 0x2e, 0xe2, 0x99, 0xc7, |
|
| 212 |
- 0x8e, 0x2e, 0xbb, 0x06, 0x49, 0x78, 0x48, 0x62, 0x66, 0xa4, 0x88, 0x9e, 0x50, 0xc2, 0x09, 0xaa, |
|
| 213 |
- 0xdd, 0xeb, 0xf5, 0x8c, 0xb8, 0xec, 0xee, 0xd6, 0x02, 0x12, 0x10, 0x29, 0x30, 0xc4, 0x2b, 0xd5, |
|
| 214 |
- 0xee, 0x36, 0x03, 0x42, 0x82, 0x39, 0x36, 0xe4, 0xd7, 0x64, 0x31, 0x35, 0x78, 0x18, 0x61, 0xc6, |
|
| 215 |
- 0xdd, 0x28, 0x49, 0x05, 0xed, 0x4f, 0x79, 0x28, 0x8f, 0xd2, 0x2c, 0xa8, 0x06, 0x45, 0x1f, 0x4f, |
|
| 216 |
- 0x16, 0x41, 0x5d, 0x69, 0x29, 0x07, 0x15, 0x3b, 0xfd, 0x40, 0x43, 0x00, 0xf9, 0x70, 0xf8, 0x32, |
|
| 217 |
- 0xc1, 0xf5, 0x8d, 0x96, 0x72, 0xb0, 0x75, 0xbc, 0xaf, 0x3f, 0x56, 0x83, 0x9e, 0x19, 0xe9, 0x7d, |
|
| 218 |
- 0xa1, 0x3f, 0x5b, 0x26, 0xd8, 0x56, 0xfd, 0xf5, 0x13, 0xed, 0x41, 0x95, 0xe2, 0x20, 0x64, 0x9c, |
|
| 219 |
- 0x2e, 0x1d, 0x4a, 0x08, 0xaf, 0xe7, 0x5b, 0xca, 0x81, 0x6a, 0xff, 0xb1, 0x06, 0x6d, 0x42, 0xb8, |
|
| 220 |
- 0x10, 0x31, 0x37, 0xf6, 0x27, 0xe4, 0xca, 0x09, 0x23, 0x37, 0xc0, 0xf5, 0x42, 0x2a, 0xca, 0x40, |
|
| 221 |
- 0x53, 0x60, 0xe8, 0x10, 0xb4, 0xb5, 0x28, 0x99, 0xbb, 0x7c, 0x4a, 0x68, 0x54, 0x2f, 0x4a, 0xdd, |
|
| 222 |
- 0x76, 0x86, 0x5b, 0x19, 0x8c, 0xde, 0xc1, 0xce, 0x9d, 0x1f, 0x23, 0x73, 0x57, 0xd4, 0x57, 0x2f, |
|
| 223 |
- 0xc9, 0x1e, 0xf4, 0x5f, 0xf7, 0x30, 0xce, 0x32, 0xae, 0xa3, 0xec, 0x75, 0xce, 0x3b, 0x04, 0x19, |
|
| 224 |
- 0x50, 0x9b, 0x10, 0xc2, 0x9d, 0x69, 0x38, 0xc7, 0x4c, 0xf6, 0xe4, 0x24, 0x2e, 0x9f, 0xd5, 0xcb, |
|
| 225 |
- 0xb2, 0x96, 0x1d, 0xc1, 0x0d, 0x05, 0x25, 0x3a, 0xb3, 0x5c, 0x3e, 0x6b, 0x1f, 0x82, 0x7a, 0x37, |
|
| 226 |
- 0x1a, 0xa4, 0x42, 0xf1, 0xd4, 0x32, 0xad, 0x81, 0x96, 0x43, 0x15, 0x28, 0x0c, 0xcd, 0x17, 0x03, |
|
| 227 |
- 0x4d, 0x41, 0x65, 0xc8, 0x0f, 0xce, 0xce, 0xb5, 0x8d, 0xb6, 0x01, 0xda, 0xc3, 0x0a, 0xd0, 0x26, |
|
| 228 |
- 0x94, 0x2d, 0x7b, 0x74, 0x32, 0x18, 0x8f, 0xb5, 0x1c, 0xda, 0x02, 0x78, 0xf6, 0xc6, 0x1a, 0xd8, |
|
| 229 |
- 0xaf, 0xcc, 0xf1, 0xc8, 0xd6, 0x94, 0xf6, 0xd7, 0x3c, 0x6c, 0x59, 0x94, 0x78, 0x98, 0xb1, 0x3e, |
|
| 230 |
- 0xe6, 0x6e, 0x38, 0x67, 0xe8, 0x1f, 0x00, 0x39, 0x44, 0x27, 0x76, 0x23, 0x2c, 0x97, 0xaa, 0xda, |
|
| 231 |
- 0xaa, 0x44, 0x4e, 0xdd, 0x08, 0xa3, 0x13, 0x00, 0x8f, 0x62, 0x97, 0x63, 0xdf, 0x71, 0xb9, 0x5c, |
|
| 232 |
- 0xec, 0xe6, 0xf1, 0xae, 0x9e, 0x1e, 0x8c, 0xbe, 0x3e, 0x18, 0xfd, 0x6c, 0x7d, 0x30, 0xbd, 0xca, |
|
| 233 |
- 0xf5, 0x4d, 0x33, 0xf7, 0xf1, 0x5b, 0x53, 0xb1, 0xd5, 0x2c, 0xee, 0x29, 0x47, 0xff, 0x02, 0xba, |
|
| 234 |
- 0xc0, 0x34, 0xc6, 0x73, 0x47, 0x5c, 0x96, 0xd3, 0xed, 0x74, 0x9c, 0x98, 0xc9, 0xd5, 0x16, 0xec, |
|
| 235 |
- 0xed, 0x94, 0x11, 0x0e, 0xdd, 0x4e, 0xe7, 0x94, 0x21, 0x1d, 0xfe, 0x8c, 0x70, 0x44, 0xe8, 0xd2, |
|
| 236 |
- 0xf1, 0x48, 0x14, 0x85, 0xdc, 0x99, 0x2c, 0x39, 0x66, 0x72, 0xc7, 0x05, 0x7b, 0x27, 0xa5, 0x4e, |
|
| 237 |
- 0x24, 0xd3, 0x13, 0x04, 0x1a, 0x42, 0x2b, 0xd3, 0xbf, 0x27, 0xf4, 0x22, 0x8c, 0x03, 0x87, 0x61, |
|
| 238 |
- 0xee, 0x24, 0x34, 0xbc, 0x74, 0x39, 0xce, 0x82, 0x8b, 0x32, 0xf8, 0xef, 0x54, 0x77, 0x9e, 0xca, |
|
| 239 |
- 0xc6, 0x98, 0x5b, 0xa9, 0x28, 0xf5, 0xe9, 0x43, 0xf3, 0x11, 0x1f, 0x36, 0x73, 0x29, 0xf6, 0x33, |
|
| 240 |
- 0x9b, 0x92, 0xb4, 0xf9, 0xeb, 0xa1, 0xcd, 0x58, 0x6a, 0x52, 0x97, 0xff, 0x00, 0x92, 0x74, 0xc0, |
|
| 241 |
- 0x4e, 0xe8, 0xcb, 0x25, 0x57, 0x7b, 0xd5, 0xd5, 0x4d, 0x53, 0xcd, 0xc6, 0x6e, 0xf6, 0x6d, 0x35, |
|
| 242 |
- 0x13, 0x98, 0x3e, 0xda, 0x07, 0x6d, 0xc1, 0x30, 0xfd, 0x69, 0x2c, 0x15, 0x99, 0xa4, 0x2a, 0xf0, |
|
| 243 |
- 0xfb, 0xa1, 0xec, 0x41, 0x19, 0x5f, 0x61, 0x4f, 0x78, 0xaa, 0x62, 0x45, 0x3d, 0x58, 0xdd, 0x34, |
|
| 244 |
- 0x4b, 0x83, 0x2b, 0xec, 0x99, 0x7d, 0xbb, 0x24, 0x28, 0xd3, 0xef, 0xf9, 0xd7, 0xb7, 0x8d, 0xdc, |
|
| 245 |
- 0x97, 0xdb, 0x46, 0xee, 0xc3, 0xaa, 0xa1, 0x5c, 0xaf, 0x1a, 0xca, 0xe7, 0x55, 0x43, 0xf9, 0xbe, |
|
| 246 |
- 0x6a, 0x28, 0x6f, 0x9f, 0xff, 0xfe, 0xdf, 0xcb, 0x93, 0xec, 0xf7, 0x75, 0x6e, 0x52, 0x92, 0x7b, |
|
| 247 |
- 0xff, 0xff, 0x47, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa3, 0x9a, 0x54, 0x17, 0xb5, 0x04, 0x00, 0x00, |
|
| 203 |
+ // 777 bytes of a gzipped FileDescriptorProto |
|
| 204 |
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xcd, 0x6f, 0xdb, 0x36, |
|
| 205 |
+ 0x1c, 0xb5, 0x9a, 0xf8, 0x43, 0xbf, 0x2e, 0xa9, 0xc2, 0xf9, 0x20, 0x64, 0x9b, 0x6d, 0xa4, 0x87, |
|
| 206 |
+ 0xa6, 0x58, 0x23, 0x25, 0xdd, 0x71, 0xa7, 0x39, 0x76, 0x56, 0x0d, 0x4b, 0x22, 0xc8, 0x59, 0xbb, |
|
| 207 |
+ 0x8f, 0x03, 0xa1, 0x0f, 0x46, 0x26, 0x6a, 0x8a, 0x02, 0x49, 0x7b, 0x71, 0x4f, 0xfb, 0x13, 0xf6, |
|
| 208 |
+ 0x47, 0xed, 0x90, 0xe3, 0x8e, 0x03, 0x06, 0x64, 0xab, 0xff, 0x92, 0x81, 0x94, 0x94, 0x62, 0x45, |
|
| 209 |
+ 0xb1, 0xcb, 0x4e, 0xa6, 0xde, 0x7b, 0x7c, 0xbf, 0x0f, 0x3e, 0x18, 0x2e, 0x73, 0xaa, 0xe6, 0xcb, |
|
| 210 |
+ 0xc4, 0x4b, 0x39, 0xf3, 0xcf, 0x69, 0x2a, 0xb8, 0xe4, 0xd7, 0xca, 0x9f, 0xa7, 0x52, 0xce, 0x29, |
|
| 211 |
+ 0xf3, 0x53, 0x96, 0xf9, 0x29, 0x2f, 0x54, 0x4c, 0x0b, 0x22, 0xb2, 0x23, 0x8d, 0x1d, 0x89, 0x65, |
|
| 212 |
+ 0x31, 0x4f, 0xe5, 0xd1, 0xea, 0xc4, 0xe7, 0xa5, 0xa2, 0xbc, 0x90, 0x7e, 0x85, 0x78, 0xa5, 0xe0, |
|
| 213 |
+ 0x8a, 0xa3, 0xfe, 0x3b, 0xbd, 0x57, 0x13, 0xab, 0x93, 0xfd, 0x7e, 0xce, 0x73, 0x6e, 0x04, 0xbe, |
|
| 214 |
+ 0x3e, 0x55, 0xda, 0xfd, 0x61, 0xce, 0x79, 0xbe, 0x20, 0xbe, 0xf9, 0x4a, 0x96, 0xd7, 0xbe, 0xa2, |
|
| 215 |
+ 0x8c, 0x48, 0x15, 0xb3, 0xb2, 0x12, 0x1c, 0xfc, 0xb6, 0x0d, 0xdd, 0xcb, 0xaa, 0x0a, 0xea, 0x43, |
|
| 216 |
+ 0x3b, 0x23, 0xc9, 0x32, 0x77, 0xad, 0x91, 0x75, 0xd8, 0x8b, 0xaa, 0x0f, 0x74, 0x06, 0x60, 0x0e, |
|
| 217 |
+ 0x58, 0xad, 0x4b, 0xe2, 0x3e, 0x18, 0x59, 0x87, 0xbb, 0xcf, 0x9f, 0x78, 0x1f, 0xea, 0xc1, 0xab, |
|
| 218 |
+ 0x8d, 0xbc, 0x89, 0xd6, 0x5f, 0xad, 0x4b, 0x12, 0xd9, 0x59, 0x73, 0x44, 0x8f, 0x61, 0x47, 0x90, |
|
| 219 |
+ 0x9c, 0x4a, 0x25, 0xd6, 0x58, 0x70, 0xae, 0xdc, 0xad, 0x91, 0x75, 0x68, 0x47, 0x1f, 0x35, 0x60, |
|
| 220 |
+ 0xc4, 0xb9, 0xd2, 0x22, 0x19, 0x17, 0x59, 0xc2, 0x6f, 0x30, 0x65, 0x71, 0x4e, 0xdc, 0xed, 0x4a, |
|
| 221 |
+ 0x54, 0x83, 0x81, 0xc6, 0xd0, 0x53, 0x70, 0x1a, 0x51, 0xb9, 0x88, 0xd5, 0x35, 0x17, 0xcc, 0x6d, |
|
| 222 |
+ 0x1b, 0xdd, 0xa3, 0x1a, 0x0f, 0x6b, 0x18, 0xfd, 0x04, 0x7b, 0xf7, 0x7e, 0x92, 0x2f, 0x62, 0xdd, |
|
| 223 |
+ 0x9f, 0xdb, 0x31, 0x33, 0x78, 0xff, 0x3d, 0xc3, 0xac, 0xae, 0xd8, 0xdc, 0x8a, 0x9a, 0x9a, 0xf7, |
|
| 224 |
+ 0x08, 0xf2, 0xa1, 0x9f, 0x70, 0xae, 0xf0, 0x35, 0x5d, 0x10, 0x69, 0x66, 0xc2, 0x65, 0xac, 0xe6, |
|
| 225 |
+ 0x6e, 0xd7, 0xf4, 0xb2, 0xa7, 0xb9, 0x33, 0x4d, 0xe9, 0xc9, 0xc2, 0x58, 0xcd, 0xd1, 0x33, 0x40, |
|
| 226 |
+ 0x2b, 0x86, 0x4b, 0xc1, 0x53, 0x22, 0x25, 0x17, 0x38, 0xe5, 0xcb, 0x42, 0xb9, 0xbd, 0x91, 0x75, |
|
| 227 |
+ 0xd8, 0x8e, 0x9c, 0x15, 0x0b, 0x1b, 0xe2, 0x54, 0xe3, 0xc8, 0x83, 0xfe, 0x8a, 0x61, 0x46, 0x18, |
|
| 228 |
+ 0x17, 0x6b, 0x2c, 0xe9, 0x1b, 0x82, 0x69, 0x81, 0x59, 0xe2, 0xda, 0x8d, 0xfe, 0xdc, 0x50, 0x33, |
|
| 229 |
+ 0xfa, 0x86, 0x04, 0xc5, 0x79, 0x82, 0x06, 0x00, 0x5f, 0x87, 0xdf, 0xbd, 0x7c, 0x31, 0xd1, 0xb5, |
|
| 230 |
+ 0x5c, 0x30, 0x4d, 0x40, 0x7e, 0x8f, 0x1c, 0x3c, 0x05, 0xfb, 0xfe, 0x61, 0x90, 0x0d, 0xed, 0x8b, |
|
| 231 |
+ 0x30, 0x08, 0xa7, 0x4e, 0x0b, 0xf5, 0x60, 0xfb, 0x2c, 0xf8, 0x76, 0xea, 0x58, 0xa8, 0x0b, 0x5b, |
|
| 232 |
+ 0xd3, 0xab, 0x57, 0xce, 0x83, 0x03, 0x1f, 0x9c, 0xf7, 0xe7, 0x47, 0x0f, 0xa1, 0x1b, 0x46, 0x97, |
|
| 233 |
+ 0xa7, 0xd3, 0xd9, 0xcc, 0x69, 0xa1, 0x5d, 0x80, 0x17, 0x3f, 0x84, 0xd3, 0xe8, 0x65, 0x30, 0xbb, |
|
| 234 |
+ 0x8c, 0x1c, 0xeb, 0xe0, 0xcf, 0x2d, 0xd8, 0xad, 0xdb, 0x9f, 0x10, 0x15, 0xd3, 0x85, 0x44, 0x9f, |
|
| 235 |
+ 0x01, 0x98, 0x27, 0xc4, 0x45, 0xcc, 0x88, 0x89, 0x94, 0x1d, 0xd9, 0x06, 0xb9, 0x88, 0x19, 0x41, |
|
| 236 |
+ 0xa7, 0x00, 0xa9, 0x20, 0xb1, 0x22, 0x19, 0x8e, 0x95, 0x89, 0xd5, 0xc3, 0xe7, 0xfb, 0x5e, 0x15, |
|
| 237 |
+ 0x57, 0xaf, 0x89, 0xab, 0x77, 0xd5, 0xc4, 0x75, 0xdc, 0xbb, 0xbd, 0x1b, 0xb6, 0x7e, 0xfd, 0x6b, |
|
| 238 |
+ 0x68, 0x45, 0x76, 0x7d, 0xef, 0x2b, 0x85, 0x3e, 0x07, 0xf4, 0x9a, 0x88, 0x82, 0x2c, 0xb0, 0xce, |
|
| 239 |
+ 0x35, 0x3e, 0x39, 0x3e, 0xc6, 0x85, 0x34, 0xc1, 0xda, 0x8e, 0x1e, 0x55, 0x8c, 0x76, 0x38, 0x39, |
|
| 240 |
+ 0x3e, 0xbe, 0x90, 0xc8, 0x83, 0x8f, 0xeb, 0x65, 0xa6, 0x9c, 0x31, 0xaa, 0x70, 0xb2, 0x56, 0x44, |
|
| 241 |
+ 0x9a, 0x84, 0x6d, 0x47, 0x7b, 0x15, 0x75, 0x6a, 0x98, 0xb1, 0x26, 0xd0, 0x19, 0x8c, 0x6a, 0xfd, |
|
| 242 |
+ 0xcf, 0x5c, 0xbc, 0xa6, 0x45, 0x8e, 0x25, 0x51, 0xb8, 0x14, 0x74, 0x15, 0x2b, 0x52, 0x5f, 0x6e, |
|
| 243 |
+ 0x9b, 0xcb, 0x9f, 0x56, 0xba, 0x57, 0x95, 0x6c, 0x46, 0x54, 0x58, 0x89, 0x2a, 0x9f, 0x09, 0x0c, |
|
| 244 |
+ 0x3f, 0xe0, 0x23, 0xe7, 0xb1, 0x20, 0x59, 0x6d, 0xd3, 0x31, 0x36, 0x9f, 0xbc, 0x6f, 0x33, 0x33, |
|
| 245 |
+ 0x9a, 0xca, 0xe5, 0x19, 0x40, 0x1d, 0x1c, 0x4c, 0x33, 0x13, 0xb1, 0x9d, 0xf1, 0xce, 0xe6, 0x6e, |
|
| 246 |
+ 0x68, 0xd7, 0x6b, 0x0f, 0x26, 0x91, 0x5d, 0x0b, 0x82, 0x0c, 0x3d, 0x01, 0x67, 0x29, 0x89, 0xf8, |
|
| 247 |
+ 0xd7, 0x5a, 0x7a, 0xa6, 0xc8, 0x8e, 0xc6, 0xdf, 0x2d, 0xe5, 0x31, 0x74, 0xc9, 0x0d, 0x49, 0xb5, |
|
| 248 |
+ 0xa7, 0xce, 0x95, 0x3d, 0x86, 0xcd, 0xdd, 0xb0, 0x33, 0xbd, 0x21, 0x69, 0x30, 0x89, 0x3a, 0x9a, |
|
| 249 |
+ 0x0a, 0xb2, 0x71, 0x76, 0xfb, 0x76, 0xd0, 0xfa, 0xe3, 0xed, 0xa0, 0xf5, 0xcb, 0x66, 0x60, 0xdd, |
|
| 250 |
+ 0x6e, 0x06, 0xd6, 0xef, 0x9b, 0x81, 0xf5, 0xf7, 0x66, 0x60, 0xfd, 0xf8, 0xcd, 0xff, 0xff, 0x73, |
|
| 251 |
+ 0xfb, 0xb2, 0xfe, 0xfd, 0xbe, 0x95, 0x74, 0xcc, 0xbb, 0x7f, 0xf1, 0x4f, 0x00, 0x00, 0x00, 0xff, |
|
| 252 |
+ 0xff, 0xc9, 0xeb, 0xae, 0x6f, 0x33, 0x05, 0x00, 0x00, |
|
| 248 | 253 |
} |
| 249 | 254 |
|
| 250 | 255 |
func (m *Options) Marshal() (dAtA []byte, err error) {
|
| ... | ... |
@@ -306,6 +325,22 @@ func (m *Options) MarshalTo(dAtA []byte) (int, error) {
|
| 306 | 306 |
i = encodeVarintRunhcs(dAtA, i, uint64(len(m.BootFilesRootPath))) |
| 307 | 307 |
i += copy(dAtA[i:], m.BootFilesRootPath) |
| 308 | 308 |
} |
| 309 |
+ if m.VmProcessorCount != 0 {
|
|
| 310 |
+ dAtA[i] = 0x40 |
|
| 311 |
+ i++ |
|
| 312 |
+ i = encodeVarintRunhcs(dAtA, i, uint64(m.VmProcessorCount)) |
|
| 313 |
+ } |
|
| 314 |
+ if m.VmMemorySizeInMb != 0 {
|
|
| 315 |
+ dAtA[i] = 0x48 |
|
| 316 |
+ i++ |
|
| 317 |
+ i = encodeVarintRunhcs(dAtA, i, uint64(m.VmMemorySizeInMb)) |
|
| 318 |
+ } |
|
| 319 |
+ if len(m.GPUVHDPath) > 0 {
|
|
| 320 |
+ dAtA[i] = 0x52 |
|
| 321 |
+ i++ |
|
| 322 |
+ i = encodeVarintRunhcs(dAtA, i, uint64(len(m.GPUVHDPath))) |
|
| 323 |
+ i += copy(dAtA[i:], m.GPUVHDPath) |
|
| 324 |
+ } |
|
| 309 | 325 |
if m.XXX_unrecognized != nil {
|
| 310 | 326 |
i += copy(dAtA[i:], m.XXX_unrecognized) |
| 311 | 327 |
} |
| ... | ... |
@@ -423,6 +458,16 @@ func (m *Options) Size() (n int) {
|
| 423 | 423 |
if l > 0 {
|
| 424 | 424 |
n += 1 + l + sovRunhcs(uint64(l)) |
| 425 | 425 |
} |
| 426 |
+ if m.VmProcessorCount != 0 {
|
|
| 427 |
+ n += 1 + sovRunhcs(uint64(m.VmProcessorCount)) |
|
| 428 |
+ } |
|
| 429 |
+ if m.VmMemorySizeInMb != 0 {
|
|
| 430 |
+ n += 1 + sovRunhcs(uint64(m.VmMemorySizeInMb)) |
|
| 431 |
+ } |
|
| 432 |
+ l = len(m.GPUVHDPath) |
|
| 433 |
+ if l > 0 {
|
|
| 434 |
+ n += 1 + l + sovRunhcs(uint64(l)) |
|
| 435 |
+ } |
|
| 426 | 436 |
if m.XXX_unrecognized != nil {
|
| 427 | 437 |
n += len(m.XXX_unrecognized) |
| 428 | 438 |
} |
| ... | ... |
@@ -494,6 +539,9 @@ func (this *Options) String() string {
|
| 494 | 494 |
`SandboxPlatform:` + fmt.Sprintf("%v", this.SandboxPlatform) + `,`,
|
| 495 | 495 |
`SandboxIsolation:` + fmt.Sprintf("%v", this.SandboxIsolation) + `,`,
|
| 496 | 496 |
`BootFilesRootPath:` + fmt.Sprintf("%v", this.BootFilesRootPath) + `,`,
|
| 497 |
+ `VmProcessorCount:` + fmt.Sprintf("%v", this.VmProcessorCount) + `,`,
|
|
| 498 |
+ `VmMemorySizeInMb:` + fmt.Sprintf("%v", this.VmMemorySizeInMb) + `,`,
|
|
| 499 |
+ `GPUVHDPath:` + fmt.Sprintf("%v", this.GPUVHDPath) + `,`,
|
|
| 497 | 500 |
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
|
| 498 | 501 |
`}`, |
| 499 | 502 |
}, "") |
| ... | ... |
@@ -741,6 +789,76 @@ func (m *Options) Unmarshal(dAtA []byte) error {
|
| 741 | 741 |
} |
| 742 | 742 |
m.BootFilesRootPath = string(dAtA[iNdEx:postIndex]) |
| 743 | 743 |
iNdEx = postIndex |
| 744 |
+ case 8: |
|
| 745 |
+ if wireType != 0 {
|
|
| 746 |
+ return fmt.Errorf("proto: wrong wireType = %d for field VmProcessorCount", wireType)
|
|
| 747 |
+ } |
|
| 748 |
+ m.VmProcessorCount = 0 |
|
| 749 |
+ for shift := uint(0); ; shift += 7 {
|
|
| 750 |
+ if shift >= 64 {
|
|
| 751 |
+ return ErrIntOverflowRunhcs |
|
| 752 |
+ } |
|
| 753 |
+ if iNdEx >= l {
|
|
| 754 |
+ return io.ErrUnexpectedEOF |
|
| 755 |
+ } |
|
| 756 |
+ b := dAtA[iNdEx] |
|
| 757 |
+ iNdEx++ |
|
| 758 |
+ m.VmProcessorCount |= int32(b&0x7F) << shift |
|
| 759 |
+ if b < 0x80 {
|
|
| 760 |
+ break |
|
| 761 |
+ } |
|
| 762 |
+ } |
|
| 763 |
+ case 9: |
|
| 764 |
+ if wireType != 0 {
|
|
| 765 |
+ return fmt.Errorf("proto: wrong wireType = %d for field VmMemorySizeInMb", wireType)
|
|
| 766 |
+ } |
|
| 767 |
+ m.VmMemorySizeInMb = 0 |
|
| 768 |
+ for shift := uint(0); ; shift += 7 {
|
|
| 769 |
+ if shift >= 64 {
|
|
| 770 |
+ return ErrIntOverflowRunhcs |
|
| 771 |
+ } |
|
| 772 |
+ if iNdEx >= l {
|
|
| 773 |
+ return io.ErrUnexpectedEOF |
|
| 774 |
+ } |
|
| 775 |
+ b := dAtA[iNdEx] |
|
| 776 |
+ iNdEx++ |
|
| 777 |
+ m.VmMemorySizeInMb |= int32(b&0x7F) << shift |
|
| 778 |
+ if b < 0x80 {
|
|
| 779 |
+ break |
|
| 780 |
+ } |
|
| 781 |
+ } |
|
| 782 |
+ case 10: |
|
| 783 |
+ if wireType != 2 {
|
|
| 784 |
+ return fmt.Errorf("proto: wrong wireType = %d for field GPUVHDPath", wireType)
|
|
| 785 |
+ } |
|
| 786 |
+ var stringLen uint64 |
|
| 787 |
+ for shift := uint(0); ; shift += 7 {
|
|
| 788 |
+ if shift >= 64 {
|
|
| 789 |
+ return ErrIntOverflowRunhcs |
|
| 790 |
+ } |
|
| 791 |
+ if iNdEx >= l {
|
|
| 792 |
+ return io.ErrUnexpectedEOF |
|
| 793 |
+ } |
|
| 794 |
+ b := dAtA[iNdEx] |
|
| 795 |
+ iNdEx++ |
|
| 796 |
+ stringLen |= uint64(b&0x7F) << shift |
|
| 797 |
+ if b < 0x80 {
|
|
| 798 |
+ break |
|
| 799 |
+ } |
|
| 800 |
+ } |
|
| 801 |
+ intStringLen := int(stringLen) |
|
| 802 |
+ if intStringLen < 0 {
|
|
| 803 |
+ return ErrInvalidLengthRunhcs |
|
| 804 |
+ } |
|
| 805 |
+ postIndex := iNdEx + intStringLen |
|
| 806 |
+ if postIndex < 0 {
|
|
| 807 |
+ return ErrInvalidLengthRunhcs |
|
| 808 |
+ } |
|
| 809 |
+ if postIndex > l {
|
|
| 810 |
+ return io.ErrUnexpectedEOF |
|
| 811 |
+ } |
|
| 812 |
+ m.GPUVHDPath = string(dAtA[iNdEx:postIndex]) |
|
| 813 |
+ iNdEx = postIndex |
|
| 744 | 814 |
default: |
| 745 | 815 |
iNdEx = preIndex |
| 746 | 816 |
skippy, err := skipRunhcs(dAtA[iNdEx:]) |
| ... | ... |
@@ -46,6 +46,23 @@ message Options {
|
| 46 | 46 |
// boot_files_root_path is the path to the directory containing the LCOW |
| 47 | 47 |
// kernel and root FS files. |
| 48 | 48 |
string boot_files_root_path = 7; |
| 49 |
+ |
|
| 50 |
+ // vm_processor_count is the default number of processors to create for the |
|
| 51 |
+ // hypervisor isolated utility vm. |
|
| 52 |
+ // |
|
| 53 |
+ // The platform default if omitted is 2, unless the host only has a single |
|
| 54 |
+ // core in which case it is 1. |
|
| 55 |
+ int32 vm_processor_count = 8; |
|
| 56 |
+ |
|
| 57 |
+ // vm_memory_size_in_mb is the default amount of memory to assign to the |
|
| 58 |
+ // hypervisor isolated utility vm. |
|
| 59 |
+ // |
|
| 60 |
+ // The platform default is 1024MB if omitted. |
|
| 61 |
+ int32 vm_memory_size_in_mb = 9; |
|
| 62 |
+ |
|
| 63 |
+ // GPUVHDPath is the path to the gpu vhd to add to the uvm |
|
| 64 |
+ // when a container requests a gpu |
|
| 65 |
+ string GPUVHDPath = 10; |
|
| 49 | 66 |
} |
| 50 | 67 |
|
| 51 | 68 |
// ProcessDetails contains additional information about a process. This is the additional |
| ... | ... |
@@ -4,34 +4,32 @@ go 1.13 |
| 4 | 4 |
|
| 5 | 5 |
require ( |
| 6 | 6 |
github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5 |
| 7 |
- github.com/blang/semver v3.1.0+incompatible // indirect |
|
| 8 | 7 |
github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f |
| 9 | 8 |
github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1 |
| 10 |
- github.com/containerd/containerd v1.3.0-beta.2.0.20190828155532-0293cbd26c69 |
|
| 9 |
+ github.com/containerd/containerd v1.3.2 |
|
| 11 | 10 |
github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc // indirect |
| 12 | 11 |
github.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448 // indirect |
| 13 | 12 |
github.com/containerd/go-runc v0.0.0-20180907222934-5a6d9f37cfa3 |
| 14 | 13 |
github.com/containerd/ttrpc v0.0.0-20190828154514-0e0f228740de |
| 15 | 14 |
github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd |
| 16 |
- github.com/gogo/protobuf v1.2.1 |
|
| 17 |
- github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce // indirect |
|
| 18 |
- github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874 // indirect |
|
| 15 |
+ github.com/gogo/protobuf v1.3.1 |
|
| 16 |
+ github.com/golang/protobuf v1.3.2 // indirect |
|
| 17 |
+ github.com/kr/pretty v0.1.0 // indirect |
|
| 19 | 18 |
github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2 // indirect |
| 20 | 19 |
github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f // indirect |
| 21 | 20 |
github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700 |
| 22 |
- github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39 |
|
| 23 | 21 |
github.com/pkg/errors v0.8.1 |
| 24 |
- github.com/prometheus/procfs v0.0.5 // indirect |
|
| 25 |
- github.com/sirupsen/logrus v1.4.1 |
|
| 26 |
- github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8 // indirect |
|
| 22 |
+ github.com/prometheus/procfs v0.0.0-20180125133057-cb4147076ac7 // indirect |
|
| 23 |
+ github.com/sirupsen/logrus v1.4.2 |
|
| 24 |
+ github.com/stretchr/testify v1.4.0 // indirect |
|
| 27 | 25 |
github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5 |
| 28 |
- github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect |
|
| 29 |
- github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect |
|
| 30 |
- github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f // indirect |
|
| 31 | 26 |
go.opencensus.io v0.22.0 |
| 32 |
- golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6 |
|
| 27 |
+ golang.org/x/net v0.0.0-20191004110552-13f9640d40b9 // indirect |
|
| 28 |
+ golang.org/x/sync v0.0.0-20190423024810-112230192c58 |
|
| 33 | 29 |
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3 |
| 34 |
- google.golang.org/grpc v1.20.1 |
|
| 30 |
+ google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873 // indirect |
|
| 31 |
+ google.golang.org/grpc v1.23.1 |
|
| 32 |
+ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect |
|
| 33 |
+ gopkg.in/yaml.v2 v2.2.8 // indirect |
|
| 35 | 34 |
gotest.tools v2.2.0+incompatible // indirect |
| 36 |
- k8s.io/kubernetes v1.13.0 |
|
| 37 | 35 |
) |
| ... | ... |
@@ -21,8 +21,11 @@ const ( |
| 21 | 21 |
OutboundNat = hns.OutboundNat |
| 22 | 22 |
ExternalLoadBalancer = hns.ExternalLoadBalancer |
| 23 | 23 |
Route = hns.Route |
| 24 |
+ Proxy = hns.Proxy |
|
| 24 | 25 |
) |
| 25 | 26 |
|
| 27 |
+type ProxyPolicy = hns.ProxyPolicy |
|
| 28 |
+ |
|
| 26 | 29 |
type NatPolicy = hns.NatPolicy |
| 27 | 30 |
|
| 28 | 31 |
type QosPolicy = hns.QosPolicy |
| 29 | 32 |
deleted file mode 100644 |
| ... | ... |
@@ -1,7 +0,0 @@ |
| 1 |
-package hcs |
|
| 2 |
- |
|
| 3 |
-import "C" |
|
| 4 |
- |
|
| 5 |
-// This import is needed to make the library compile as CGO because HCSSHIM |
|
| 6 |
-// only works with CGO due to callbacks from HCS comming back from a C thread |
|
| 7 |
-// which is not supported without CGO. See https://github.com/golang/go/issues/10973 |
| ... | ... |
@@ -4,12 +4,9 @@ import ( |
| 4 | 4 |
"context" |
| 5 | 5 |
"encoding/json" |
| 6 | 6 |
"errors" |
| 7 |
- "os" |
|
| 8 |
- "strconv" |
|
| 9 | 7 |
"strings" |
| 10 | 8 |
"sync" |
| 11 | 9 |
"syscall" |
| 12 |
- "time" |
|
| 13 | 10 |
|
| 14 | 11 |
"github.com/Microsoft/hcsshim/internal/cow" |
| 15 | 12 |
"github.com/Microsoft/hcsshim/internal/log" |
| ... | ... |
@@ -21,27 +18,6 @@ import ( |
| 21 | 21 |
"go.opencensus.io/trace" |
| 22 | 22 |
) |
| 23 | 23 |
|
| 24 |
-// currentContainerStarts is used to limit the number of concurrent container |
|
| 25 |
-// starts. |
|
| 26 |
-var currentContainerStarts containerStarts |
|
| 27 |
- |
|
| 28 |
-type containerStarts struct {
|
|
| 29 |
- maxParallel int |
|
| 30 |
- inProgress int |
|
| 31 |
- sync.Mutex |
|
| 32 |
-} |
|
| 33 |
- |
|
| 34 |
-func init() {
|
|
| 35 |
- mpsS := os.Getenv("HCSSHIM_MAX_PARALLEL_START")
|
|
| 36 |
- if len(mpsS) > 0 {
|
|
| 37 |
- mpsI, err := strconv.Atoi(mpsS) |
|
| 38 |
- if err != nil || mpsI < 0 {
|
|
| 39 |
- return |
|
| 40 |
- } |
|
| 41 |
- currentContainerStarts.maxParallel = mpsI |
|
| 42 |
- } |
|
| 43 |
-} |
|
| 44 |
- |
|
| 45 | 24 |
type System struct {
|
| 46 | 25 |
handleLock sync.RWMutex |
| 47 | 26 |
handle vmcompute.HcsSystem |
| ... | ... |
@@ -215,32 +191,6 @@ func (computeSystem *System) Start(ctx context.Context) (err error) {
|
| 215 | 215 |
return makeSystemError(computeSystem, operation, "", ErrAlreadyClosed, nil) |
| 216 | 216 |
} |
| 217 | 217 |
|
| 218 |
- // This is a very simple backoff-retry loop to limit the number |
|
| 219 |
- // of parallel container starts if environment variable |
|
| 220 |
- // HCSSHIM_MAX_PARALLEL_START is set to a positive integer. |
|
| 221 |
- // It should generally only be used as a workaround to various |
|
| 222 |
- // platform issues that exist between RS1 and RS4 as of Aug 2018 |
|
| 223 |
- if currentContainerStarts.maxParallel > 0 {
|
|
| 224 |
- for {
|
|
| 225 |
- currentContainerStarts.Lock() |
|
| 226 |
- if currentContainerStarts.inProgress < currentContainerStarts.maxParallel {
|
|
| 227 |
- currentContainerStarts.inProgress++ |
|
| 228 |
- currentContainerStarts.Unlock() |
|
| 229 |
- break |
|
| 230 |
- } |
|
| 231 |
- if currentContainerStarts.inProgress == currentContainerStarts.maxParallel {
|
|
| 232 |
- currentContainerStarts.Unlock() |
|
| 233 |
- time.Sleep(100 * time.Millisecond) |
|
| 234 |
- } |
|
| 235 |
- } |
|
| 236 |
- // Make sure we decrement the count when we are done. |
|
| 237 |
- defer func() {
|
|
| 238 |
- currentContainerStarts.Lock() |
|
| 239 |
- currentContainerStarts.inProgress-- |
|
| 240 |
- currentContainerStarts.Unlock() |
|
| 241 |
- }() |
|
| 242 |
- } |
|
| 243 |
- |
|
| 244 | 218 |
resultJSON, err := vmcompute.HcsStartComputeSystem(ctx, computeSystem.handle, "") |
| 245 | 219 |
events, err := processAsyncHcsResult(ctx, err, resultJSON, computeSystem.callbackNumber, hcsNotificationSystemStartCompleted, &timeout.SystemStart) |
| 246 | 220 |
if err != nil {
|
| ... | ... |
@@ -1,10 +1,14 @@ |
| 1 | 1 |
package hcs |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "context" |
|
| 4 | 5 |
"io" |
| 5 | 6 |
"syscall" |
| 6 | 7 |
|
| 7 | 8 |
"github.com/Microsoft/go-winio" |
| 9 |
+ diskutil "github.com/Microsoft/go-winio/vhd" |
|
| 10 |
+ "github.com/pkg/errors" |
|
| 11 |
+ "golang.org/x/sys/windows" |
|
| 8 | 12 |
) |
| 9 | 13 |
|
| 10 | 14 |
// 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) {
|
| 31 | 31 |
} |
| 32 | 32 |
return fs, nil |
| 33 | 33 |
} |
| 34 |
+ |
|
| 35 |
+// creates a VHD formatted with NTFS of size `sizeGB` at the given `vhdPath`. |
|
| 36 |
+func CreateNTFSVHD(ctx context.Context, vhdPath string, sizeGB uint32) (err error) {
|
|
| 37 |
+ if err := diskutil.CreateVhdx(vhdPath, sizeGB, 1); err != nil {
|
|
| 38 |
+ return errors.Wrap(err, "failed to create VHD") |
|
| 39 |
+ } |
|
| 40 |
+ |
|
| 41 |
+ vhd, err := diskutil.OpenVirtualDisk(vhdPath, diskutil.VirtualDiskAccessNone, diskutil.OpenVirtualDiskFlagNone) |
|
| 42 |
+ if err != nil {
|
|
| 43 |
+ return errors.Wrap(err, "failed to open VHD") |
|
| 44 |
+ } |
|
| 45 |
+ defer func() {
|
|
| 46 |
+ err2 := windows.CloseHandle(windows.Handle(vhd)) |
|
| 47 |
+ if err == nil {
|
|
| 48 |
+ err = errors.Wrap(err2, "failed to close VHD") |
|
| 49 |
+ } |
|
| 50 |
+ }() |
|
| 51 |
+ |
|
| 52 |
+ if err := hcsFormatWritableLayerVhd(uintptr(vhd)); err != nil {
|
|
| 53 |
+ return errors.Wrap(err, "failed to format VHD") |
|
| 54 |
+ } |
|
| 55 |
+ |
|
| 56 |
+ return nil |
|
| 57 |
+} |
| 34 | 58 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,54 @@ |
| 0 |
+// Code generated mksyscall_windows.exe DO NOT EDIT |
|
| 1 |
+ |
|
| 2 |
+package hcs |
|
| 3 |
+ |
|
| 4 |
+import ( |
|
| 5 |
+ "syscall" |
|
| 6 |
+ "unsafe" |
|
| 7 |
+ |
|
| 8 |
+ "golang.org/x/sys/windows" |
|
| 9 |
+) |
|
| 10 |
+ |
|
| 11 |
+var _ unsafe.Pointer |
|
| 12 |
+ |
|
| 13 |
+// Do the interface allocations only once for common |
|
| 14 |
+// Errno values. |
|
| 15 |
+const ( |
|
| 16 |
+ errnoERROR_IO_PENDING = 997 |
|
| 17 |
+) |
|
| 18 |
+ |
|
| 19 |
+var ( |
|
| 20 |
+ errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING) |
|
| 21 |
+) |
|
| 22 |
+ |
|
| 23 |
+// errnoErr returns common boxed Errno values, to prevent |
|
| 24 |
+// allocations at runtime. |
|
| 25 |
+func errnoErr(e syscall.Errno) error {
|
|
| 26 |
+ switch e {
|
|
| 27 |
+ case 0: |
|
| 28 |
+ return nil |
|
| 29 |
+ case errnoERROR_IO_PENDING: |
|
| 30 |
+ return errERROR_IO_PENDING |
|
| 31 |
+ } |
|
| 32 |
+ // TODO: add more here, after collecting data on the common |
|
| 33 |
+ // error values see on Windows. (perhaps when running |
|
| 34 |
+ // all.bat?) |
|
| 35 |
+ return e |
|
| 36 |
+} |
|
| 37 |
+ |
|
| 38 |
+var ( |
|
| 39 |
+ modcomputestorage = windows.NewLazySystemDLL("computestorage.dll")
|
|
| 40 |
+ |
|
| 41 |
+ procHcsFormatWritableLayerVhd = modcomputestorage.NewProc("HcsFormatWritableLayerVhd")
|
|
| 42 |
+) |
|
| 43 |
+ |
|
| 44 |
+func hcsFormatWritableLayerVhd(handle uintptr) (hr error) {
|
|
| 45 |
+ r0, _, _ := syscall.Syscall(procHcsFormatWritableLayerVhd.Addr(), 1, uintptr(handle), 0, 0) |
|
| 46 |
+ if int32(r0) < 0 {
|
|
| 47 |
+ if r0&0x1fff0000 == 0x00070000 {
|
|
| 48 |
+ r0 &= 0xffff |
|
| 49 |
+ } |
|
| 50 |
+ hr = syscall.Errno(r0) |
|
| 51 |
+ } |
|
| 52 |
+ return |
|
| 53 |
+} |
| ... | ... |
@@ -173,6 +173,27 @@ func (endpoint *HNSEndpoint) ApplyACLPolicy(policies ...*ACLPolicy) error {
|
| 173 | 173 |
return err |
| 174 | 174 |
} |
| 175 | 175 |
|
| 176 |
+// ApplyProxyPolicy applies a set of Proxy Policies on the Endpoint |
|
| 177 |
+func (endpoint *HNSEndpoint) ApplyProxyPolicy(policies ...*ProxyPolicy) error {
|
|
| 178 |
+ operation := "ApplyProxyPolicy" |
|
| 179 |
+ title := "hcsshim::HNSEndpoint::" + operation |
|
| 180 |
+ logrus.Debugf(title+" id=%s", endpoint.Id) |
|
| 181 |
+ |
|
| 182 |
+ for _, policy := range policies {
|
|
| 183 |
+ if policy == nil {
|
|
| 184 |
+ continue |
|
| 185 |
+ } |
|
| 186 |
+ jsonString, err := json.Marshal(policy) |
|
| 187 |
+ if err != nil {
|
|
| 188 |
+ return err |
|
| 189 |
+ } |
|
| 190 |
+ endpoint.Policies = append(endpoint.Policies, jsonString) |
|
| 191 |
+ } |
|
| 192 |
+ |
|
| 193 |
+ _, err := endpoint.Update() |
|
| 194 |
+ return err |
|
| 195 |
+} |
|
| 196 |
+ |
|
| 176 | 197 |
// ContainerAttach attaches an endpoint to container |
| 177 | 198 |
func (endpoint *HNSEndpoint) ContainerAttach(containerID string, compartmentID uint16) error {
|
| 178 | 199 |
operation := "ContainerAttach" |
| ... | ... |
@@ -17,6 +17,7 @@ const ( |
| 17 | 17 |
OutboundNat PolicyType = "OutBoundNAT" |
| 18 | 18 |
ExternalLoadBalancer PolicyType = "ELB" |
| 19 | 19 |
Route PolicyType = "ROUTE" |
| 20 |
+ Proxy PolicyType = "PROXY" |
|
| 20 | 21 |
) |
| 21 | 22 |
|
| 22 | 23 |
type NatPolicy struct {
|
| ... | ... |
@@ -60,6 +61,15 @@ type OutboundNatPolicy struct {
|
| 60 | 60 |
Destinations []string `json:",omitempty"` |
| 61 | 61 |
} |
| 62 | 62 |
|
| 63 |
+type ProxyPolicy struct {
|
|
| 64 |
+ Type PolicyType `json:"Type"` |
|
| 65 |
+ IP string `json:",omitempty"` |
|
| 66 |
+ Port string `json:",omitempty"` |
|
| 67 |
+ ExceptionList []string `json:",omitempty"` |
|
| 68 |
+ Destination string `json:",omitempty"` |
|
| 69 |
+ OutboundNat bool `json:",omitempty"` |
|
| 70 |
+} |
|
| 71 |
+ |
|
| 63 | 72 |
type ActionType string |
| 64 | 73 |
type DirectionType string |
| 65 | 74 |
type RuleType string |
| ... | ... |
@@ -214,9 +214,10 @@ type MappedVirtualDiskController struct {
|
| 214 | 214 |
|
| 215 | 215 |
// GuestDefinedCapabilities is part of the GuestConnectionInfo returned by a GuestConnection call on a utility VM |
| 216 | 216 |
type GuestDefinedCapabilities struct {
|
| 217 |
- NamespaceAddRequestSupported bool `json:",omitempty"` |
|
| 218 |
- SignalProcessSupported bool `json:",omitempty"` |
|
| 219 |
- DumpStacksSupported bool `json:",omitempty"` |
|
| 217 |
+ NamespaceAddRequestSupported bool `json:",omitempty"` |
|
| 218 |
+ SignalProcessSupported bool `json:",omitempty"` |
|
| 219 |
+ DumpStacksSupported bool `json:",omitempty"` |
|
| 220 |
+ DeleteContainerStateSupported bool `json:",omitempty"` |
|
| 220 | 221 |
} |
| 221 | 222 |
|
| 222 | 223 |
// GuestConnectionInfo is the structure of an iterm return by a GuestConnection call on a utility VM |
| ... | ... |
@@ -39,4 +39,8 @@ type Devices struct {
|
| 39 | 39 |
FlexibleIov map[string]FlexibleIoDevice `json:"FlexibleIov,omitempty"` |
| 40 | 40 |
|
| 41 | 41 |
SharedMemory *SharedMemoryConfiguration `json:"SharedMemory,omitempty"` |
| 42 |
+ |
|
| 43 |
+ // TODO: This is pre-release support in schema 2.3. Need to add build number |
|
| 44 |
+ // docs when a public build with this is out. |
|
| 45 |
+ VirtualPci map[string]VirtualPciDevice `json:",omitempty"` |
|
| 42 | 46 |
} |
| ... | ... |
@@ -27,4 +27,23 @@ type Memory2 struct {
|
| 27 | 27 |
// to the VM, allowing it to trim non-zeroed pages from the working set (if supported by |
| 28 | 28 |
// the guest operating system). |
| 29 | 29 |
EnableColdDiscardHint bool `json:"EnableColdDiscardHint,omitempty"` |
| 30 |
+ |
|
| 31 |
+ // LowMmioGapInMB is the low MMIO region allocated below 4GB. |
|
| 32 |
+ // |
|
| 33 |
+ // TODO: This is pre-release support in schema 2.3. Need to add build number |
|
| 34 |
+ // docs when a public build with this is out. |
|
| 35 |
+ LowMMIOGapInMB uint64 `json:"LowMmioGapInMB,omitempty"` |
|
| 36 |
+ |
|
| 37 |
+ // HighMmioBaseInMB is the high MMIO region allocated above 4GB (base and |
|
| 38 |
+ // size). |
|
| 39 |
+ // |
|
| 40 |
+ // TODO: This is pre-release support in schema 2.3. Need to add build number |
|
| 41 |
+ // docs when a public build with this is out. |
|
| 42 |
+ HighMMIOBaseInMB uint64 `json:"HighMmioBaseInMB,omitempty"` |
|
| 43 |
+ |
|
| 44 |
+ // HighMmioGapInMB is the high MMIO region. |
|
| 45 |
+ // |
|
| 46 |
+ // TODO: This is pre-release support in schema 2.3. Need to add build number |
|
| 47 |
+ // docs when a public build with this is out. |
|
| 48 |
+ HighMMIOGapInMB uint64 `json:"HighMmioGapInMB,omitempty"` |
|
| 30 | 49 |
} |
| 31 | 50 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,16 @@ |
| 0 |
+/* |
|
| 1 |
+ * HCS API |
|
| 2 |
+ * |
|
| 3 |
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) |
|
| 4 |
+ * |
|
| 5 |
+ * API version: 2.3 |
|
| 6 |
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) |
|
| 7 |
+ */ |
|
| 8 |
+ |
|
| 9 |
+package hcsschema |
|
| 10 |
+ |
|
| 11 |
+// TODO: This is pre-release support in schema 2.3. Need to add build number |
|
| 12 |
+// docs when a public build with this is out. |
|
| 13 |
+type VirtualPciDevice struct {
|
|
| 14 |
+ Functions []VirtualPciFunction `json:",omitempty"` |
|
| 15 |
+} |
| 0 | 16 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,18 @@ |
| 0 |
+/* |
|
| 1 |
+ * HCS API |
|
| 2 |
+ * |
|
| 3 |
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) |
|
| 4 |
+ * |
|
| 5 |
+ * API version: 2.3 |
|
| 6 |
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) |
|
| 7 |
+ */ |
|
| 8 |
+ |
|
| 9 |
+package hcsschema |
|
| 10 |
+ |
|
| 11 |
+// TODO: This is pre-release support in schema 2.3. Need to add build number |
|
| 12 |
+// docs when a public build with this is out. |
|
| 13 |
+type VirtualPciFunction struct {
|
|
| 14 |
+ DeviceInstancePath string `json:",omitempty"` |
|
| 15 |
+ |
|
| 16 |
+ VirtualFunction uint16 `json:",omitempty"` |
|
| 17 |
+} |
| ... | ... |
@@ -1,28 +1,23 @@ |
| 1 | 1 |
package wclayer |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "context" |
|
| 5 |
+ |
|
| 4 | 6 |
"github.com/Microsoft/hcsshim/internal/hcserror" |
| 5 |
- "github.com/sirupsen/logrus" |
|
| 7 |
+ "github.com/Microsoft/hcsshim/internal/oc" |
|
| 8 |
+ "go.opencensus.io/trace" |
|
| 6 | 9 |
) |
| 7 | 10 |
|
| 8 | 11 |
// ActivateLayer will find the layer with the given id and mount it's filesystem. |
| 9 | 12 |
// For a read/write layer, the mounted filesystem will appear as a volume on the |
| 10 | 13 |
// host, while a read-only layer is generally expected to be a no-op. |
| 11 | 14 |
// An activated layer must later be deactivated via DeactivateLayer. |
| 12 |
-func ActivateLayer(path string) (err error) {
|
|
| 15 |
+func ActivateLayer(ctx context.Context, path string) (err error) {
|
|
| 13 | 16 |
title := "hcsshim::ActivateLayer" |
| 14 |
- fields := logrus.Fields{
|
|
| 15 |
- "path": path, |
|
| 16 |
- } |
|
| 17 |
- logrus.WithFields(fields).Debug(title) |
|
| 18 |
- defer func() {
|
|
| 19 |
- if err != nil {
|
|
| 20 |
- fields[logrus.ErrorKey] = err |
|
| 21 |
- logrus.WithFields(fields).Error(err) |
|
| 22 |
- } else {
|
|
| 23 |
- logrus.WithFields(fields).Debug(title + " - succeeded") |
|
| 24 |
- } |
|
| 25 |
- }() |
|
| 17 |
+ ctx, span := trace.StartSpan(ctx, title) |
|
| 18 |
+ defer span.End() |
|
| 19 |
+ defer func() { oc.SetSpanStatus(span, err) }()
|
|
| 20 |
+ span.AddAttributes(trace.StringAttribute("path", path))
|
|
| 26 | 21 |
|
| 27 | 22 |
err = activateLayer(&stdDriverInfo, path) |
| 28 | 23 |
if err != nil {
|
| ... | ... |
@@ -1,6 +1,7 @@ |
| 1 | 1 |
package wclayer |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "context" |
|
| 4 | 5 |
"errors" |
| 5 | 6 |
"os" |
| 6 | 7 |
"path/filepath" |
| ... | ... |
@@ -8,10 +9,15 @@ import ( |
| 8 | 8 |
|
| 9 | 9 |
"github.com/Microsoft/go-winio" |
| 10 | 10 |
"github.com/Microsoft/hcsshim/internal/hcserror" |
| 11 |
+ "github.com/Microsoft/hcsshim/internal/oc" |
|
| 11 | 12 |
"github.com/Microsoft/hcsshim/internal/safefile" |
| 13 |
+ "go.opencensus.io/trace" |
|
| 12 | 14 |
) |
| 13 | 15 |
|
| 14 | 16 |
type baseLayerWriter struct {
|
| 17 |
+ ctx context.Context |
|
| 18 |
+ s *trace.Span |
|
| 19 |
+ |
|
| 15 | 20 |
root *os.File |
| 16 | 21 |
f *os.File |
| 17 | 22 |
bw *winio.BackupFileWriter |
| ... | ... |
@@ -136,12 +142,15 @@ func (w *baseLayerWriter) Write(b []byte) (int, error) {
|
| 136 | 136 |
return n, err |
| 137 | 137 |
} |
| 138 | 138 |
|
| 139 |
-func (w *baseLayerWriter) Close() error {
|
|
| 139 |
+func (w *baseLayerWriter) Close() (err error) {
|
|
| 140 |
+ defer w.s.End() |
|
| 141 |
+ defer func() { oc.SetSpanStatus(w.s, err) }()
|
|
| 140 | 142 |
defer func() {
|
| 141 | 143 |
w.root.Close() |
| 142 | 144 |
w.root = nil |
| 143 | 145 |
}() |
| 144 |
- err := w.closeCurrentFile() |
|
| 146 |
+ |
|
| 147 |
+ err = w.closeCurrentFile() |
|
| 145 | 148 |
if err != nil {
|
| 146 | 149 |
return err |
| 147 | 150 |
} |
| ... | ... |
@@ -153,7 +162,7 @@ func (w *baseLayerWriter) Close() error {
|
| 153 | 153 |
return err |
| 154 | 154 |
} |
| 155 | 155 |
|
| 156 |
- err = ProcessBaseLayer(w.root.Name()) |
|
| 156 |
+ err = ProcessBaseLayer(w.ctx, w.root.Name()) |
|
| 157 | 157 |
if err != nil {
|
| 158 | 158 |
return err |
| 159 | 159 |
} |
| ... | ... |
@@ -163,7 +172,7 @@ func (w *baseLayerWriter) Close() error {
|
| 163 | 163 |
if err != nil {
|
| 164 | 164 |
return err |
| 165 | 165 |
} |
| 166 |
- err = ProcessUtilityVMImage(filepath.Join(w.root.Name(), "UtilityVM")) |
|
| 166 |
+ err = ProcessUtilityVMImage(w.ctx, filepath.Join(w.root.Name(), "UtilityVM")) |
|
| 167 | 167 |
if err != nil {
|
| 168 | 168 |
return err |
| 169 | 169 |
} |
| ... | ... |
@@ -1,27 +1,23 @@ |
| 1 | 1 |
package wclayer |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "context" |
|
| 5 |
+ |
|
| 4 | 6 |
"github.com/Microsoft/hcsshim/internal/hcserror" |
| 5 |
- "github.com/sirupsen/logrus" |
|
| 7 |
+ "github.com/Microsoft/hcsshim/internal/oc" |
|
| 8 |
+ "go.opencensus.io/trace" |
|
| 6 | 9 |
) |
| 7 | 10 |
|
| 8 | 11 |
// CreateLayer creates a new, empty, read-only layer on the filesystem based on |
| 9 | 12 |
// the parent layer provided. |
| 10 |
-func CreateLayer(path, parent string) (err error) {
|
|
| 13 |
+func CreateLayer(ctx context.Context, path, parent string) (err error) {
|
|
| 11 | 14 |
title := "hcsshim::CreateLayer" |
| 12 |
- fields := logrus.Fields{
|
|
| 13 |
- "parent": parent, |
|
| 14 |
- "path": path, |
|
| 15 |
- } |
|
| 16 |
- logrus.WithFields(fields).Debug(title) |
|
| 17 |
- defer func() {
|
|
| 18 |
- if err != nil {
|
|
| 19 |
- fields[logrus.ErrorKey] = err |
|
| 20 |
- logrus.WithFields(fields).Error(err) |
|
| 21 |
- } else {
|
|
| 22 |
- logrus.WithFields(fields).Debug(title + " - succeeded") |
|
| 23 |
- } |
|
| 24 |
- }() |
|
| 15 |
+ ctx, span := trace.StartSpan(ctx, title) |
|
| 16 |
+ defer span.End() |
|
| 17 |
+ defer func() { oc.SetSpanStatus(span, err) }()
|
|
| 18 |
+ span.AddAttributes( |
|
| 19 |
+ trace.StringAttribute("path", path),
|
|
| 20 |
+ trace.StringAttribute("parent", parent))
|
|
| 25 | 21 |
|
| 26 | 22 |
err = createLayer(&stdDriverInfo, path, parent) |
| 27 | 23 |
if err != nil {
|
| ... | ... |
@@ -1,31 +1,29 @@ |
| 1 | 1 |
package wclayer |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "context" |
|
| 5 |
+ "strings" |
|
| 6 |
+ |
|
| 4 | 7 |
"github.com/Microsoft/hcsshim/internal/hcserror" |
| 5 |
- "github.com/sirupsen/logrus" |
|
| 8 |
+ "github.com/Microsoft/hcsshim/internal/oc" |
|
| 9 |
+ "go.opencensus.io/trace" |
|
| 6 | 10 |
) |
| 7 | 11 |
|
| 8 | 12 |
// CreateScratchLayer creates and populates new read-write layer for use by a container. |
| 9 | 13 |
// This requires both the id of the direct parent layer, as well as the full list |
| 10 | 14 |
// of paths to all parent layers up to the base (and including the direct parent |
| 11 | 15 |
// whose id was provided). |
| 12 |
-func CreateScratchLayer(path string, parentLayerPaths []string) (err error) {
|
|
| 16 |
+func CreateScratchLayer(ctx context.Context, path string, parentLayerPaths []string) (err error) {
|
|
| 13 | 17 |
title := "hcsshim::CreateScratchLayer" |
| 14 |
- fields := logrus.Fields{
|
|
| 15 |
- "path": path, |
|
| 16 |
- } |
|
| 17 |
- logrus.WithFields(fields).Debug(title) |
|
| 18 |
- defer func() {
|
|
| 19 |
- if err != nil {
|
|
| 20 |
- fields[logrus.ErrorKey] = err |
|
| 21 |
- logrus.WithFields(fields).Error(err) |
|
| 22 |
- } else {
|
|
| 23 |
- logrus.WithFields(fields).Debug(title + " - succeeded") |
|
| 24 |
- } |
|
| 25 |
- }() |
|
| 18 |
+ ctx, span := trace.StartSpan(ctx, title) |
|
| 19 |
+ defer span.End() |
|
| 20 |
+ defer func() { oc.SetSpanStatus(span, err) }()
|
|
| 21 |
+ span.AddAttributes( |
|
| 22 |
+ trace.StringAttribute("path", path),
|
|
| 23 |
+ trace.StringAttribute("parentLayerPaths", strings.Join(parentLayerPaths, ", ")))
|
|
| 26 | 24 |
|
| 27 | 25 |
// Generate layer descriptors |
| 28 |
- layers, err := layerPathsToDescriptors(parentLayerPaths) |
|
| 26 |
+ layers, err := layerPathsToDescriptors(ctx, parentLayerPaths) |
|
| 29 | 27 |
if err != nil {
|
| 30 | 28 |
return err |
| 31 | 29 |
} |
| ... | ... |
@@ -1,25 +1,20 @@ |
| 1 | 1 |
package wclayer |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "context" |
|
| 5 |
+ |
|
| 4 | 6 |
"github.com/Microsoft/hcsshim/internal/hcserror" |
| 5 |
- "github.com/sirupsen/logrus" |
|
| 7 |
+ "github.com/Microsoft/hcsshim/internal/oc" |
|
| 8 |
+ "go.opencensus.io/trace" |
|
| 6 | 9 |
) |
| 7 | 10 |
|
| 8 | 11 |
// DeactivateLayer will dismount a layer that was mounted via ActivateLayer. |
| 9 |
-func DeactivateLayer(path string) (err error) {
|
|
| 12 |
+func DeactivateLayer(ctx context.Context, path string) (err error) {
|
|
| 10 | 13 |
title := "hcsshim::DeactivateLayer" |
| 11 |
- fields := logrus.Fields{
|
|
| 12 |
- "path": path, |
|
| 13 |
- } |
|
| 14 |
- logrus.WithFields(fields).Debug(title) |
|
| 15 |
- defer func() {
|
|
| 16 |
- if err != nil {
|
|
| 17 |
- fields[logrus.ErrorKey] = err |
|
| 18 |
- logrus.WithFields(fields).Error(err) |
|
| 19 |
- } else {
|
|
| 20 |
- logrus.WithFields(fields).Debug(title + " - succeeded") |
|
| 21 |
- } |
|
| 22 |
- }() |
|
| 14 |
+ ctx, span := trace.StartSpan(ctx, title) |
|
| 15 |
+ defer span.End() |
|
| 16 |
+ defer func() { oc.SetSpanStatus(span, err) }()
|
|
| 17 |
+ span.AddAttributes(trace.StringAttribute("path", path))
|
|
| 23 | 18 |
|
| 24 | 19 |
err = deactivateLayer(&stdDriverInfo, path) |
| 25 | 20 |
if err != nil {
|
| ... | ... |
@@ -1,26 +1,21 @@ |
| 1 | 1 |
package wclayer |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "context" |
|
| 5 |
+ |
|
| 4 | 6 |
"github.com/Microsoft/hcsshim/internal/hcserror" |
| 5 |
- "github.com/sirupsen/logrus" |
|
| 7 |
+ "github.com/Microsoft/hcsshim/internal/oc" |
|
| 8 |
+ "go.opencensus.io/trace" |
|
| 6 | 9 |
) |
| 7 | 10 |
|
| 8 | 11 |
// DestroyLayer will remove the on-disk files representing the layer with the given |
| 9 | 12 |
// path, including that layer's containing folder, if any. |
| 10 |
-func DestroyLayer(path string) (err error) {
|
|
| 13 |
+func DestroyLayer(ctx context.Context, path string) (err error) {
|
|
| 11 | 14 |
title := "hcsshim::DestroyLayer" |
| 12 |
- fields := logrus.Fields{
|
|
| 13 |
- "path": path, |
|
| 14 |
- } |
|
| 15 |
- logrus.WithFields(fields).Debug(title) |
|
| 16 |
- defer func() {
|
|
| 17 |
- if err != nil {
|
|
| 18 |
- fields[logrus.ErrorKey] = err |
|
| 19 |
- logrus.WithFields(fields).Error(err) |
|
| 20 |
- } else {
|
|
| 21 |
- logrus.WithFields(fields).Debug(title + " - succeeded") |
|
| 22 |
- } |
|
| 23 |
- }() |
|
| 15 |
+ ctx, span := trace.StartSpan(ctx, title) |
|
| 16 |
+ defer span.End() |
|
| 17 |
+ defer func() { oc.SetSpanStatus(span, err) }()
|
|
| 18 |
+ span.AddAttributes(trace.StringAttribute("path", path))
|
|
| 24 | 19 |
|
| 25 | 20 |
err = destroyLayer(&stdDriverInfo, path) |
| 26 | 21 |
if err != nil {
|
| ... | ... |
@@ -1,32 +1,27 @@ |
| 1 | 1 |
package wclayer |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "context" |
|
| 4 | 5 |
"os" |
| 5 | 6 |
"path/filepath" |
| 6 | 7 |
"syscall" |
| 7 | 8 |
"unsafe" |
| 8 | 9 |
|
| 9 | 10 |
"github.com/Microsoft/hcsshim/internal/hcserror" |
| 11 |
+ "github.com/Microsoft/hcsshim/internal/oc" |
|
| 10 | 12 |
"github.com/Microsoft/hcsshim/osversion" |
| 11 |
- "github.com/sirupsen/logrus" |
|
| 13 |
+ "go.opencensus.io/trace" |
|
| 12 | 14 |
) |
| 13 | 15 |
|
| 14 | 16 |
// ExpandScratchSize expands the size of a layer to at least size bytes. |
| 15 |
-func ExpandScratchSize(path string, size uint64) (err error) {
|
|
| 17 |
+func ExpandScratchSize(ctx context.Context, path string, size uint64) (err error) {
|
|
| 16 | 18 |
title := "hcsshim::ExpandScratchSize" |
| 17 |
- fields := logrus.Fields{
|
|
| 18 |
- "path": path, |
|
| 19 |
- "size": size, |
|
| 20 |
- } |
|
| 21 |
- logrus.WithFields(fields).Debug(title) |
|
| 22 |
- defer func() {
|
|
| 23 |
- if err != nil {
|
|
| 24 |
- fields[logrus.ErrorKey] = err |
|
| 25 |
- logrus.WithFields(fields).Error(err) |
|
| 26 |
- } else {
|
|
| 27 |
- logrus.WithFields(fields).Debug(title + " - succeeded") |
|
| 28 |
- } |
|
| 29 |
- }() |
|
| 19 |
+ ctx, span := trace.StartSpan(ctx, title) |
|
| 20 |
+ defer span.End() |
|
| 21 |
+ defer func() { oc.SetSpanStatus(span, err) }()
|
|
| 22 |
+ span.AddAttributes( |
|
| 23 |
+ trace.StringAttribute("path", path),
|
|
| 24 |
+ trace.Int64Attribute("size", int64(size)))
|
|
| 30 | 25 |
|
| 31 | 26 |
err = expandSandboxSize(&stdDriverInfo, path, size) |
| 32 | 27 |
if err != nil {
|
| ... | ... |
@@ -36,7 +31,7 @@ func ExpandScratchSize(path string, size uint64) (err error) {
|
| 36 | 36 |
// Manually expand the volume now in order to work around bugs in 19H1 and |
| 37 | 37 |
// prerelease versions of Vb. Remove once this is fixed in Windows. |
| 38 | 38 |
if build := osversion.Get().Build; build >= osversion.V19H1 && build < 19020 {
|
| 39 |
- err = expandSandboxVolume(path) |
|
| 39 |
+ err = expandSandboxVolume(ctx, path) |
|
| 40 | 40 |
if err != nil {
|
| 41 | 41 |
return err |
| 42 | 42 |
} |
| ... | ... |
@@ -84,7 +79,7 @@ func attachVhd(path string) (syscall.Handle, error) {
|
| 84 | 84 |
return handle, nil |
| 85 | 85 |
} |
| 86 | 86 |
|
| 87 |
-func expandSandboxVolume(path string) error {
|
|
| 87 |
+func expandSandboxVolume(ctx context.Context, path string) error {
|
|
| 88 | 88 |
// Mount the sandbox VHD temporarily. |
| 89 | 89 |
vhdPath := filepath.Join(path, "sandbox.vhdx") |
| 90 | 90 |
vhd, err := attachVhd(vhdPath) |
| ... | ... |
@@ -94,7 +89,7 @@ func expandSandboxVolume(path string) error {
|
| 94 | 94 |
defer syscall.Close(vhd) |
| 95 | 95 |
|
| 96 | 96 |
// Open the volume. |
| 97 |
- volumePath, err := GetLayerMountPath(path) |
|
| 97 |
+ volumePath, err := GetLayerMountPath(ctx, path) |
|
| 98 | 98 |
if err != nil {
|
| 99 | 99 |
return err |
| 100 | 100 |
} |
| ... | ... |
@@ -1,12 +1,15 @@ |
| 1 | 1 |
package wclayer |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "context" |
|
| 4 | 5 |
"io/ioutil" |
| 5 | 6 |
"os" |
| 7 |
+ "strings" |
|
| 6 | 8 |
|
| 7 | 9 |
"github.com/Microsoft/go-winio" |
| 8 | 10 |
"github.com/Microsoft/hcsshim/internal/hcserror" |
| 9 |
- "github.com/sirupsen/logrus" |
|
| 11 |
+ "github.com/Microsoft/hcsshim/internal/oc" |
|
| 12 |
+ "go.opencensus.io/trace" |
|
| 10 | 13 |
) |
| 11 | 14 |
|
| 12 | 15 |
// ExportLayer will create a folder at exportFolderPath and fill that folder with |
| ... | ... |
@@ -14,24 +17,18 @@ import ( |
| 14 | 14 |
// format includes any metadata required for later importing the layer (using |
| 15 | 15 |
// ImportLayer), and requires the full list of parent layer paths in order to |
| 16 | 16 |
// perform the export. |
| 17 |
-func ExportLayer(path string, exportFolderPath string, parentLayerPaths []string) (err error) {
|
|
| 17 |
+func ExportLayer(ctx context.Context, path string, exportFolderPath string, parentLayerPaths []string) (err error) {
|
|
| 18 | 18 |
title := "hcsshim::ExportLayer" |
| 19 |
- fields := logrus.Fields{
|
|
| 20 |
- "path": path, |
|
| 21 |
- "exportFolderPath": exportFolderPath, |
|
| 22 |
- } |
|
| 23 |
- logrus.WithFields(fields).Debug(title) |
|
| 24 |
- defer func() {
|
|
| 25 |
- if err != nil {
|
|
| 26 |
- fields[logrus.ErrorKey] = err |
|
| 27 |
- logrus.WithFields(fields).Error(err) |
|
| 28 |
- } else {
|
|
| 29 |
- logrus.WithFields(fields).Debug(title + " - succeeded") |
|
| 30 |
- } |
|
| 31 |
- }() |
|
| 19 |
+ ctx, span := trace.StartSpan(ctx, title) |
|
| 20 |
+ defer span.End() |
|
| 21 |
+ defer func() { oc.SetSpanStatus(span, err) }()
|
|
| 22 |
+ span.AddAttributes( |
|
| 23 |
+ trace.StringAttribute("path", path),
|
|
| 24 |
+ trace.StringAttribute("exportFolderPath", exportFolderPath),
|
|
| 25 |
+ trace.StringAttribute("parentLayerPaths", strings.Join(parentLayerPaths, ", ")))
|
|
| 32 | 26 |
|
| 33 | 27 |
// Generate layer descriptors |
| 34 |
- layers, err := layerPathsToDescriptors(parentLayerPaths) |
|
| 28 |
+ layers, err := layerPathsToDescriptors(ctx, parentLayerPaths) |
|
| 35 | 29 |
if err != nil {
|
| 36 | 30 |
return err |
| 37 | 31 |
} |
| ... | ... |
@@ -52,25 +49,46 @@ type LayerReader interface {
|
| 52 | 52 |
// NewLayerReader returns a new layer reader for reading the contents of an on-disk layer. |
| 53 | 53 |
// The caller must have taken the SeBackupPrivilege privilege |
| 54 | 54 |
// to call this and any methods on the resulting LayerReader. |
| 55 |
-func NewLayerReader(path string, parentLayerPaths []string) (LayerReader, error) {
|
|
| 55 |
+func NewLayerReader(ctx context.Context, path string, parentLayerPaths []string) (_ LayerReader, err error) {
|
|
| 56 |
+ ctx, span := trace.StartSpan(ctx, "hcsshim::NewLayerReader") |
|
| 57 |
+ defer func() {
|
|
| 58 |
+ if err != nil {
|
|
| 59 |
+ oc.SetSpanStatus(span, err) |
|
| 60 |
+ span.End() |
|
| 61 |
+ } |
|
| 62 |
+ }() |
|
| 63 |
+ span.AddAttributes( |
|
| 64 |
+ trace.StringAttribute("path", path),
|
|
| 65 |
+ trace.StringAttribute("parentLayerPaths", strings.Join(parentLayerPaths, ", ")))
|
|
| 66 |
+ |
|
| 56 | 67 |
exportPath, err := ioutil.TempDir("", "hcs")
|
| 57 | 68 |
if err != nil {
|
| 58 | 69 |
return nil, err |
| 59 | 70 |
} |
| 60 |
- err = ExportLayer(path, exportPath, parentLayerPaths) |
|
| 71 |
+ err = ExportLayer(ctx, path, exportPath, parentLayerPaths) |
|
| 61 | 72 |
if err != nil {
|
| 62 | 73 |
os.RemoveAll(exportPath) |
| 63 | 74 |
return nil, err |
| 64 | 75 |
} |
| 65 |
- return &legacyLayerReaderWrapper{newLegacyLayerReader(exportPath)}, nil
|
|
| 76 |
+ return &legacyLayerReaderWrapper{
|
|
| 77 |
+ ctx: ctx, |
|
| 78 |
+ s: span, |
|
| 79 |
+ legacyLayerReader: newLegacyLayerReader(exportPath), |
|
| 80 |
+ }, nil |
|
| 66 | 81 |
} |
| 67 | 82 |
|
| 68 | 83 |
type legacyLayerReaderWrapper struct {
|
| 84 |
+ ctx context.Context |
|
| 85 |
+ s *trace.Span |
|
| 86 |
+ |
|
| 69 | 87 |
*legacyLayerReader |
| 70 | 88 |
} |
| 71 | 89 |
|
| 72 |
-func (r *legacyLayerReaderWrapper) Close() error {
|
|
| 73 |
- err := r.legacyLayerReader.Close() |
|
| 90 |
+func (r *legacyLayerReaderWrapper) Close() (err error) {
|
|
| 91 |
+ defer r.s.End() |
|
| 92 |
+ defer func() { oc.SetSpanStatus(r.s, err) }()
|
|
| 93 |
+ |
|
| 94 |
+ err = r.legacyLayerReader.Close() |
|
| 74 | 95 |
os.RemoveAll(r.root) |
| 75 | 96 |
return err |
| 76 | 97 |
} |
| ... | ... |
@@ -1,36 +1,31 @@ |
| 1 | 1 |
package wclayer |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "context" |
|
| 4 | 5 |
"syscall" |
| 5 | 6 |
|
| 6 | 7 |
"github.com/Microsoft/hcsshim/internal/hcserror" |
| 7 |
- "github.com/sirupsen/logrus" |
|
| 8 |
+ "github.com/Microsoft/hcsshim/internal/log" |
|
| 9 |
+ "github.com/Microsoft/hcsshim/internal/oc" |
|
| 10 |
+ "go.opencensus.io/trace" |
|
| 8 | 11 |
) |
| 9 | 12 |
|
| 10 | 13 |
// GetLayerMountPath will look for a mounted layer with the given path and return |
| 11 | 14 |
// the path at which that layer can be accessed. This path may be a volume path |
| 12 | 15 |
// if the layer is a mounted read-write layer, otherwise it is expected to be the |
| 13 | 16 |
// folder path at which the layer is stored. |
| 14 |
-func GetLayerMountPath(path string) (_ string, err error) {
|
|
| 17 |
+func GetLayerMountPath(ctx context.Context, path string) (_ string, err error) {
|
|
| 15 | 18 |
title := "hcsshim::GetLayerMountPath" |
| 16 |
- fields := logrus.Fields{
|
|
| 17 |
- "path": path, |
|
| 18 |
- } |
|
| 19 |
- logrus.WithFields(fields).Debug(title) |
|
| 20 |
- defer func() {
|
|
| 21 |
- if err != nil {
|
|
| 22 |
- fields[logrus.ErrorKey] = err |
|
| 23 |
- logrus.WithFields(fields).Error(err) |
|
| 24 |
- } else {
|
|
| 25 |
- logrus.WithFields(fields).Debug(title + " - succeeded") |
|
| 26 |
- } |
|
| 27 |
- }() |
|
| 19 |
+ ctx, span := trace.StartSpan(ctx, title) |
|
| 20 |
+ defer span.End() |
|
| 21 |
+ defer func() { oc.SetSpanStatus(span, err) }()
|
|
| 22 |
+ span.AddAttributes(trace.StringAttribute("path", path))
|
|
| 28 | 23 |
|
| 29 | 24 |
var mountPathLength uintptr |
| 30 | 25 |
mountPathLength = 0 |
| 31 | 26 |
|
| 32 | 27 |
// Call the procedure itself. |
| 33 |
- logrus.WithFields(fields).Debug("Calling proc (1)")
|
|
| 28 |
+ log.G(ctx).Debug("Calling proc (1)")
|
|
| 34 | 29 |
err = getLayerMountPath(&stdDriverInfo, path, &mountPathLength, nil) |
| 35 | 30 |
if err != nil {
|
| 36 | 31 |
return "", hcserror.New(err, title+" - failed", "(first call)") |
| ... | ... |
@@ -44,13 +39,13 @@ func GetLayerMountPath(path string) (_ string, err error) {
|
| 44 | 44 |
mountPathp[0] = 0 |
| 45 | 45 |
|
| 46 | 46 |
// Call the procedure again |
| 47 |
- logrus.WithFields(fields).Debug("Calling proc (2)")
|
|
| 47 |
+ log.G(ctx).Debug("Calling proc (2)")
|
|
| 48 | 48 |
err = getLayerMountPath(&stdDriverInfo, path, &mountPathLength, &mountPathp[0]) |
| 49 | 49 |
if err != nil {
|
| 50 | 50 |
return "", hcserror.New(err, title+" - failed", "(second call)") |
| 51 | 51 |
} |
| 52 | 52 |
|
| 53 | 53 |
mountPath := syscall.UTF16ToString(mountPathp[0:]) |
| 54 |
- fields["mountPath"] = mountPath |
|
| 54 |
+ span.AddAttributes(trace.StringAttribute("mountPath", mountPath))
|
|
| 55 | 55 |
return mountPath, nil |
| 56 | 56 |
} |
| ... | ... |
@@ -1,29 +1,29 @@ |
| 1 | 1 |
package wclayer |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "context" |
|
| 5 |
+ |
|
| 4 | 6 |
"github.com/Microsoft/hcsshim/internal/hcserror" |
| 5 | 7 |
"github.com/Microsoft/hcsshim/internal/interop" |
| 6 |
- "github.com/sirupsen/logrus" |
|
| 8 |
+ "github.com/Microsoft/hcsshim/internal/oc" |
|
| 9 |
+ "go.opencensus.io/trace" |
|
| 7 | 10 |
) |
| 8 | 11 |
|
| 9 | 12 |
// GetSharedBaseImages will enumerate the images stored in the common central |
| 10 | 13 |
// image store and return descriptive info about those images for the purpose |
| 11 | 14 |
// of registering them with the graphdriver, graph, and tagstore. |
| 12 |
-func GetSharedBaseImages() (imageData string, err error) {
|
|
| 15 |
+func GetSharedBaseImages(ctx context.Context) (_ string, err error) {
|
|
| 13 | 16 |
title := "hcsshim::GetSharedBaseImages" |
| 14 |
- logrus.Debug(title) |
|
| 15 |
- defer func() {
|
|
| 16 |
- if err != nil {
|
|
| 17 |
- logrus.WithError(err).Error(err) |
|
| 18 |
- } else {
|
|
| 19 |
- logrus.WithField("imageData", imageData).Debug(title + " - succeeded")
|
|
| 20 |
- } |
|
| 21 |
- }() |
|
| 17 |
+ ctx, span := trace.StartSpan(ctx, title) |
|
| 18 |
+ defer span.End() |
|
| 19 |
+ defer func() { oc.SetSpanStatus(span, err) }()
|
|
| 22 | 20 |
|
| 23 | 21 |
var buffer *uint16 |
| 24 | 22 |
err = getBaseImages(&buffer) |
| 25 | 23 |
if err != nil {
|
| 26 | 24 |
return "", hcserror.New(err, title+" - failed", "") |
| 27 | 25 |
} |
| 28 |
- return interop.ConvertAndFreeCoTaskMemString(buffer), nil |
|
| 26 |
+ imageData := interop.ConvertAndFreeCoTaskMemString(buffer) |
|
| 27 |
+ span.AddAttributes(trace.StringAttribute("imageData", imageData))
|
|
| 28 |
+ return imageData, nil |
|
| 29 | 29 |
} |
| ... | ... |
@@ -1,26 +1,22 @@ |
| 1 | 1 |
package wclayer |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "context" |
|
| 5 |
+ |
|
| 4 | 6 |
"github.com/Microsoft/hcsshim/internal/hcserror" |
| 5 |
- "github.com/sirupsen/logrus" |
|
| 7 |
+ "github.com/Microsoft/hcsshim/internal/oc" |
|
| 8 |
+ "go.opencensus.io/trace" |
|
| 6 | 9 |
) |
| 7 | 10 |
|
| 8 | 11 |
// GrantVmAccess adds access to a file for a given VM |
| 9 |
-func GrantVmAccess(vmid string, filepath string) (err error) {
|
|
| 12 |
+func GrantVmAccess(ctx context.Context, vmid string, filepath string) (err error) {
|
|
| 10 | 13 |
title := "hcsshim::GrantVmAccess" |
| 11 |
- fields := logrus.Fields{
|
|
| 12 |
- "vm-id": vmid, |
|
| 13 |
- "path": filepath, |
|
| 14 |
- } |
|
| 15 |
- logrus.WithFields(fields).Debug(title) |
|
| 16 |
- defer func() {
|
|
| 17 |
- if err != nil {
|
|
| 18 |
- fields[logrus.ErrorKey] = err |
|
| 19 |
- logrus.WithFields(fields).Error(err) |
|
| 20 |
- } else {
|
|
| 21 |
- logrus.WithFields(fields).Debug(title + " - succeeded") |
|
| 22 |
- } |
|
| 23 |
- }() |
|
| 14 |
+ ctx, span := trace.StartSpan(ctx, title) |
|
| 15 |
+ defer span.End() |
|
| 16 |
+ defer func() { oc.SetSpanStatus(span, err) }()
|
|
| 17 |
+ span.AddAttributes( |
|
| 18 |
+ trace.StringAttribute("vm-id", vmid),
|
|
| 19 |
+ trace.StringAttribute("path", filepath))
|
|
| 24 | 20 |
|
| 25 | 21 |
err = grantVmAccess(vmid, filepath) |
| 26 | 22 |
if err != nil {
|
| ... | ... |
@@ -1,38 +1,35 @@ |
| 1 | 1 |
package wclayer |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "context" |
|
| 4 | 5 |
"io/ioutil" |
| 5 | 6 |
"os" |
| 6 | 7 |
"path/filepath" |
| 8 |
+ "strings" |
|
| 7 | 9 |
|
| 8 | 10 |
"github.com/Microsoft/go-winio" |
| 9 | 11 |
"github.com/Microsoft/hcsshim/internal/hcserror" |
| 12 |
+ "github.com/Microsoft/hcsshim/internal/oc" |
|
| 10 | 13 |
"github.com/Microsoft/hcsshim/internal/safefile" |
| 11 |
- "github.com/sirupsen/logrus" |
|
| 14 |
+ "go.opencensus.io/trace" |
|
| 12 | 15 |
) |
| 13 | 16 |
|
| 14 | 17 |
// ImportLayer will take the contents of the folder at importFolderPath and import |
| 15 | 18 |
// that into a layer with the id layerId. Note that in order to correctly populate |
| 16 | 19 |
// the layer and interperet the transport format, all parent layers must already |
| 17 | 20 |
// be present on the system at the paths provided in parentLayerPaths. |
| 18 |
-func ImportLayer(path string, importFolderPath string, parentLayerPaths []string) (err error) {
|
|
| 21 |
+func ImportLayer(ctx context.Context, path string, importFolderPath string, parentLayerPaths []string) (err error) {
|
|
| 19 | 22 |
title := "hcsshim::ImportLayer" |
| 20 |
- fields := logrus.Fields{
|
|
| 21 |
- "path": path, |
|
| 22 |
- "importFolderPath": importFolderPath, |
|
| 23 |
- } |
|
| 24 |
- logrus.WithFields(fields).Debug(title) |
|
| 25 |
- defer func() {
|
|
| 26 |
- if err != nil {
|
|
| 27 |
- fields[logrus.ErrorKey] = err |
|
| 28 |
- logrus.WithFields(fields).Error(err) |
|
| 29 |
- } else {
|
|
| 30 |
- logrus.WithFields(fields).Debug(title + " - succeeded") |
|
| 31 |
- } |
|
| 32 |
- }() |
|
| 23 |
+ ctx, span := trace.StartSpan(ctx, title) |
|
| 24 |
+ defer span.End() |
|
| 25 |
+ defer func() { oc.SetSpanStatus(span, err) }()
|
|
| 26 |
+ span.AddAttributes( |
|
| 27 |
+ trace.StringAttribute("path", path),
|
|
| 28 |
+ trace.StringAttribute("importFolderPath", importFolderPath),
|
|
| 29 |
+ trace.StringAttribute("parentLayerPaths", strings.Join(parentLayerPaths, ", ")))
|
|
| 33 | 30 |
|
| 34 | 31 |
// Generate layer descriptors |
| 35 |
- layers, err := layerPathsToDescriptors(parentLayerPaths) |
|
| 32 |
+ layers, err := layerPathsToDescriptors(ctx, parentLayerPaths) |
|
| 36 | 33 |
if err != nil {
|
| 37 | 34 |
return err |
| 38 | 35 |
} |
| ... | ... |
@@ -60,20 +57,26 @@ type LayerWriter interface {
|
| 60 | 60 |
} |
| 61 | 61 |
|
| 62 | 62 |
type legacyLayerWriterWrapper struct {
|
| 63 |
+ ctx context.Context |
|
| 64 |
+ s *trace.Span |
|
| 65 |
+ |
|
| 63 | 66 |
*legacyLayerWriter |
| 64 | 67 |
path string |
| 65 | 68 |
parentLayerPaths []string |
| 66 | 69 |
} |
| 67 | 70 |
|
| 68 |
-func (r *legacyLayerWriterWrapper) Close() error {
|
|
| 71 |
+func (r *legacyLayerWriterWrapper) Close() (err error) {
|
|
| 72 |
+ defer r.s.End() |
|
| 73 |
+ defer func() { oc.SetSpanStatus(r.s, err) }()
|
|
| 69 | 74 |
defer os.RemoveAll(r.root.Name()) |
| 70 | 75 |
defer r.legacyLayerWriter.CloseRoots() |
| 71 |
- err := r.legacyLayerWriter.Close() |
|
| 76 |
+ |
|
| 77 |
+ err = r.legacyLayerWriter.Close() |
|
| 72 | 78 |
if err != nil {
|
| 73 | 79 |
return err |
| 74 | 80 |
} |
| 75 | 81 |
|
| 76 |
- if err = ImportLayer(r.destRoot.Name(), r.path, r.parentLayerPaths); err != nil {
|
|
| 82 |
+ if err = ImportLayer(r.ctx, r.destRoot.Name(), r.path, r.parentLayerPaths); err != nil {
|
|
| 77 | 83 |
return err |
| 78 | 84 |
} |
| 79 | 85 |
for _, name := range r.Tombstones {
|
| ... | ... |
@@ -96,7 +99,7 @@ func (r *legacyLayerWriterWrapper) Close() error {
|
| 96 | 96 |
if err != nil {
|
| 97 | 97 |
return err |
| 98 | 98 |
} |
| 99 |
- err = ProcessUtilityVMImage(filepath.Join(r.destRoot.Name(), "UtilityVM")) |
|
| 99 |
+ err = ProcessUtilityVMImage(r.ctx, filepath.Join(r.destRoot.Name(), "UtilityVM")) |
|
| 100 | 100 |
if err != nil {
|
| 101 | 101 |
return err |
| 102 | 102 |
} |
| ... | ... |
@@ -107,7 +110,18 @@ func (r *legacyLayerWriterWrapper) Close() error {
|
| 107 | 107 |
// NewLayerWriter returns a new layer writer for creating a layer on disk. |
| 108 | 108 |
// The caller must have taken the SeBackupPrivilege and SeRestorePrivilege privileges |
| 109 | 109 |
// to call this and any methods on the resulting LayerWriter. |
| 110 |
-func NewLayerWriter(path string, parentLayerPaths []string) (LayerWriter, error) {
|
|
| 110 |
+func NewLayerWriter(ctx context.Context, path string, parentLayerPaths []string) (_ LayerWriter, err error) {
|
|
| 111 |
+ ctx, span := trace.StartSpan(ctx, "hcsshim::NewLayerWriter") |
|
| 112 |
+ defer func() {
|
|
| 113 |
+ if err != nil {
|
|
| 114 |
+ oc.SetSpanStatus(span, err) |
|
| 115 |
+ span.End() |
|
| 116 |
+ } |
|
| 117 |
+ }() |
|
| 118 |
+ span.AddAttributes( |
|
| 119 |
+ trace.StringAttribute("path", path),
|
|
| 120 |
+ trace.StringAttribute("parentLayerPaths", strings.Join(parentLayerPaths, ", ")))
|
|
| 121 |
+ |
|
| 111 | 122 |
if len(parentLayerPaths) == 0 {
|
| 112 | 123 |
// This is a base layer. It gets imported differently. |
| 113 | 124 |
f, err := safefile.OpenRoot(path) |
| ... | ... |
@@ -115,6 +129,8 @@ func NewLayerWriter(path string, parentLayerPaths []string) (LayerWriter, error) |
| 115 | 115 |
return nil, err |
| 116 | 116 |
} |
| 117 | 117 |
return &baseLayerWriter{
|
| 118 |
+ ctx: ctx, |
|
| 119 |
+ s: span, |
|
| 118 | 120 |
root: f, |
| 119 | 121 |
}, nil |
| 120 | 122 |
} |
| ... | ... |
@@ -128,6 +144,8 @@ func NewLayerWriter(path string, parentLayerPaths []string) (LayerWriter, error) |
| 128 | 128 |
return nil, err |
| 129 | 129 |
} |
| 130 | 130 |
return &legacyLayerWriterWrapper{
|
| 131 |
+ ctx: ctx, |
|
| 132 |
+ s: span, |
|
| 131 | 133 |
legacyLayerWriter: w, |
| 132 | 134 |
path: importPath, |
| 133 | 135 |
parentLayerPaths: parentLayerPaths, |
| ... | ... |
@@ -1,26 +1,21 @@ |
| 1 | 1 |
package wclayer |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "context" |
|
| 5 |
+ |
|
| 4 | 6 |
"github.com/Microsoft/hcsshim/internal/hcserror" |
| 5 |
- "github.com/sirupsen/logrus" |
|
| 7 |
+ "github.com/Microsoft/hcsshim/internal/oc" |
|
| 8 |
+ "go.opencensus.io/trace" |
|
| 6 | 9 |
) |
| 7 | 10 |
|
| 8 | 11 |
// LayerExists will return true if a layer with the given id exists and is known |
| 9 | 12 |
// to the system. |
| 10 |
-func LayerExists(path string) (_ bool, err error) {
|
|
| 13 |
+func LayerExists(ctx context.Context, path string) (_ bool, err error) {
|
|
| 11 | 14 |
title := "hcsshim::LayerExists" |
| 12 |
- fields := logrus.Fields{
|
|
| 13 |
- "path": path, |
|
| 14 |
- } |
|
| 15 |
- logrus.WithFields(fields).Debug(title) |
|
| 16 |
- defer func() {
|
|
| 17 |
- if err != nil {
|
|
| 18 |
- fields[logrus.ErrorKey] = err |
|
| 19 |
- logrus.WithFields(fields).Error(err) |
|
| 20 |
- } else {
|
|
| 21 |
- logrus.WithFields(fields).Debug(title + " - succeeded") |
|
| 22 |
- } |
|
| 23 |
- }() |
|
| 15 |
+ ctx, span := trace.StartSpan(ctx, title) |
|
| 16 |
+ defer span.End() |
|
| 17 |
+ defer func() { oc.SetSpanStatus(span, err) }()
|
|
| 18 |
+ span.AddAttributes(trace.StringAttribute("path", path))
|
|
| 24 | 19 |
|
| 25 | 20 |
// Call the procedure itself. |
| 26 | 21 |
var exists uint32 |
| ... | ... |
@@ -28,6 +23,6 @@ func LayerExists(path string) (_ bool, err error) {
|
| 28 | 28 |
if err != nil {
|
| 29 | 29 |
return false, hcserror.New(err, title+" - failed", "") |
| 30 | 30 |
} |
| 31 |
- fields["layer-exists"] = exists != 0 |
|
| 31 |
+ span.AddAttributes(trace.BoolAttribute("layer-exists", exists != 0))
|
|
| 32 | 32 |
return exists != 0, nil |
| 33 | 33 |
} |
| ... | ... |
@@ -1,13 +1,22 @@ |
| 1 | 1 |
package wclayer |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "context" |
|
| 4 | 5 |
"path/filepath" |
| 5 | 6 |
|
| 6 | 7 |
"github.com/Microsoft/go-winio/pkg/guid" |
| 8 |
+ "github.com/Microsoft/hcsshim/internal/oc" |
|
| 9 |
+ "go.opencensus.io/trace" |
|
| 7 | 10 |
) |
| 8 | 11 |
|
| 9 | 12 |
// LayerID returns the layer ID of a layer on disk. |
| 10 |
-func LayerID(path string) (guid.GUID, error) {
|
|
| 13 |
+func LayerID(ctx context.Context, path string) (_ guid.GUID, err error) {
|
|
| 14 |
+ title := "hcsshim::LayerID" |
|
| 15 |
+ ctx, span := trace.StartSpan(ctx, title) |
|
| 16 |
+ defer span.End() |
|
| 17 |
+ defer func() { oc.SetSpanStatus(span, err) }()
|
|
| 18 |
+ span.AddAttributes(trace.StringAttribute("path", path))
|
|
| 19 |
+ |
|
| 11 | 20 |
_, file := filepath.Split(path) |
| 12 |
- return NameToGuid(file) |
|
| 21 |
+ return NameToGuid(ctx, file) |
|
| 13 | 22 |
} |
| ... | ... |
@@ -4,6 +4,7 @@ package wclayer |
| 4 | 4 |
// functionality. |
| 5 | 5 |
|
| 6 | 6 |
import ( |
| 7 |
+ "context" |
|
| 7 | 8 |
"syscall" |
| 8 | 9 |
|
| 9 | 10 |
"github.com/Microsoft/go-winio/pkg/guid" |
| ... | ... |
@@ -68,12 +69,12 @@ type WC_LAYER_DESCRIPTOR struct {
|
| 68 | 68 |
Pathp *uint16 |
| 69 | 69 |
} |
| 70 | 70 |
|
| 71 |
-func layerPathsToDescriptors(parentLayerPaths []string) ([]WC_LAYER_DESCRIPTOR, error) {
|
|
| 71 |
+func layerPathsToDescriptors(ctx context.Context, parentLayerPaths []string) ([]WC_LAYER_DESCRIPTOR, error) {
|
|
| 72 | 72 |
// Array of descriptors that gets constructed. |
| 73 | 73 |
var layers []WC_LAYER_DESCRIPTOR |
| 74 | 74 |
|
| 75 | 75 |
for i := 0; i < len(parentLayerPaths); i++ {
|
| 76 |
- g, err := LayerID(parentLayerPaths[i]) |
|
| 76 |
+ g, err := LayerID(ctx, parentLayerPaths[i]) |
|
| 77 | 77 |
if err != nil {
|
| 78 | 78 |
logrus.WithError(err).Debug("Failed to convert name to guid")
|
| 79 | 79 |
return nil, err |
| ... | ... |
@@ -1,34 +1,29 @@ |
| 1 | 1 |
package wclayer |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "context" |
|
| 5 |
+ |
|
| 4 | 6 |
"github.com/Microsoft/go-winio/pkg/guid" |
| 5 | 7 |
"github.com/Microsoft/hcsshim/internal/hcserror" |
| 6 |
- "github.com/sirupsen/logrus" |
|
| 8 |
+ "github.com/Microsoft/hcsshim/internal/oc" |
|
| 9 |
+ "go.opencensus.io/trace" |
|
| 7 | 10 |
) |
| 8 | 11 |
|
| 9 | 12 |
// NameToGuid converts the given string into a GUID using the algorithm in the |
| 10 | 13 |
// Host Compute Service, ensuring GUIDs generated with the same string are common |
| 11 | 14 |
// across all clients. |
| 12 |
-func NameToGuid(name string) (id guid.GUID, err error) {
|
|
| 15 |
+func NameToGuid(ctx context.Context, name string) (_ guid.GUID, err error) {
|
|
| 13 | 16 |
title := "hcsshim::NameToGuid" |
| 14 |
- fields := logrus.Fields{
|
|
| 15 |
- "name": name, |
|
| 16 |
- } |
|
| 17 |
- logrus.WithFields(fields).Debug(title) |
|
| 18 |
- defer func() {
|
|
| 19 |
- if err != nil {
|
|
| 20 |
- fields[logrus.ErrorKey] = err |
|
| 21 |
- logrus.WithFields(fields).Error(err) |
|
| 22 |
- } else {
|
|
| 23 |
- logrus.WithFields(fields).Debug(title + " - succeeded") |
|
| 24 |
- } |
|
| 25 |
- }() |
|
| 17 |
+ ctx, span := trace.StartSpan(ctx, title) |
|
| 18 |
+ defer span.End() |
|
| 19 |
+ defer func() { oc.SetSpanStatus(span, err) }()
|
|
| 20 |
+ span.AddAttributes(trace.StringAttribute("name", name))
|
|
| 26 | 21 |
|
| 22 |
+ var id guid.GUID |
|
| 27 | 23 |
err = nameToGuid(name, &id) |
| 28 | 24 |
if err != nil {
|
| 29 |
- err = hcserror.New(err, title+" - failed", "") |
|
| 30 |
- return |
|
| 25 |
+ return guid.GUID{}, hcserror.New(err, title+" - failed", "")
|
|
| 31 | 26 |
} |
| 32 |
- fields["guid"] = id.String() |
|
| 33 |
- return |
|
| 27 |
+ span.AddAttributes(trace.StringAttribute("guid", id.String()))
|
|
| 28 |
+ return id, nil |
|
| 34 | 29 |
} |
| ... | ... |
@@ -1,10 +1,13 @@ |
| 1 | 1 |
package wclayer |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "context" |
|
| 5 |
+ "strings" |
|
| 4 | 6 |
"sync" |
| 5 | 7 |
|
| 6 | 8 |
"github.com/Microsoft/hcsshim/internal/hcserror" |
| 7 |
- "github.com/sirupsen/logrus" |
|
| 9 |
+ "github.com/Microsoft/hcsshim/internal/oc" |
|
| 10 |
+ "go.opencensus.io/trace" |
|
| 8 | 11 |
) |
| 9 | 12 |
|
| 10 | 13 |
var prepareLayerLock sync.Mutex |
| ... | ... |
@@ -14,23 +17,17 @@ var prepareLayerLock sync.Mutex |
| 14 | 14 |
// parent layers, and is necessary in order to view or interact with the layer |
| 15 | 15 |
// as an actual filesystem (reading and writing files, creating directories, etc). |
| 16 | 16 |
// Disabling the filter must be done via UnprepareLayer. |
| 17 |
-func PrepareLayer(path string, parentLayerPaths []string) (err error) {
|
|
| 17 |
+func PrepareLayer(ctx context.Context, path string, parentLayerPaths []string) (err error) {
|
|
| 18 | 18 |
title := "hcsshim::PrepareLayer" |
| 19 |
- fields := logrus.Fields{
|
|
| 20 |
- "path": path, |
|
| 21 |
- } |
|
| 22 |
- logrus.WithFields(fields).Debug(title) |
|
| 23 |
- defer func() {
|
|
| 24 |
- if err != nil {
|
|
| 25 |
- fields[logrus.ErrorKey] = err |
|
| 26 |
- logrus.WithFields(fields).Error(err) |
|
| 27 |
- } else {
|
|
| 28 |
- logrus.WithFields(fields).Debug(title + " - succeeded") |
|
| 29 |
- } |
|
| 30 |
- }() |
|
| 19 |
+ ctx, span := trace.StartSpan(ctx, title) |
|
| 20 |
+ defer span.End() |
|
| 21 |
+ defer func() { oc.SetSpanStatus(span, err) }()
|
|
| 22 |
+ span.AddAttributes( |
|
| 23 |
+ trace.StringAttribute("path", path),
|
|
| 24 |
+ trace.StringAttribute("parentLayerPaths", strings.Join(parentLayerPaths, ", ")))
|
|
| 31 | 25 |
|
| 32 | 26 |
// Generate layer descriptors |
| 33 |
- layers, err := layerPathsToDescriptors(parentLayerPaths) |
|
| 27 |
+ layers, err := layerPathsToDescriptors(ctx, parentLayerPaths) |
|
| 34 | 28 |
if err != nil {
|
| 35 | 29 |
return err |
| 36 | 30 |
} |
| ... | ... |
@@ -1,23 +1,41 @@ |
| 1 | 1 |
package wclayer |
| 2 | 2 |
|
| 3 |
-import "os" |
|
| 3 |
+import ( |
|
| 4 |
+ "context" |
|
| 5 |
+ "os" |
|
| 6 |
+ |
|
| 7 |
+ "github.com/Microsoft/hcsshim/internal/oc" |
|
| 8 |
+ "go.opencensus.io/trace" |
|
| 9 |
+) |
|
| 4 | 10 |
|
| 5 | 11 |
// ProcessBaseLayer post-processes a base layer that has had its files extracted. |
| 6 | 12 |
// The files should have been extracted to <path>\Files. |
| 7 |
-func ProcessBaseLayer(path string) error {
|
|
| 8 |
- err := processBaseImage(path) |
|
| 13 |
+func ProcessBaseLayer(ctx context.Context, path string) (err error) {
|
|
| 14 |
+ title := "hcsshim::ProcessBaseLayer" |
|
| 15 |
+ ctx, span := trace.StartSpan(ctx, title) |
|
| 16 |
+ defer span.End() |
|
| 17 |
+ defer func() { oc.SetSpanStatus(span, err) }()
|
|
| 18 |
+ span.AddAttributes(trace.StringAttribute("path", path))
|
|
| 19 |
+ |
|
| 20 |
+ err = processBaseImage(path) |
|
| 9 | 21 |
if err != nil {
|
| 10 |
- return &os.PathError{Op: "ProcessBaseLayer", Path: path, Err: err}
|
|
| 22 |
+ return &os.PathError{Op: title, Path: path, Err: err}
|
|
| 11 | 23 |
} |
| 12 | 24 |
return nil |
| 13 | 25 |
} |
| 14 | 26 |
|
| 15 | 27 |
// ProcessUtilityVMImage post-processes a utility VM image that has had its files extracted. |
| 16 | 28 |
// The files should have been extracted to <path>\Files. |
| 17 |
-func ProcessUtilityVMImage(path string) error {
|
|
| 18 |
- err := processUtilityImage(path) |
|
| 29 |
+func ProcessUtilityVMImage(ctx context.Context, path string) (err error) {
|
|
| 30 |
+ title := "hcsshim::ProcessUtilityVMImage" |
|
| 31 |
+ ctx, span := trace.StartSpan(ctx, title) |
|
| 32 |
+ defer span.End() |
|
| 33 |
+ defer func() { oc.SetSpanStatus(span, err) }()
|
|
| 34 |
+ span.AddAttributes(trace.StringAttribute("path", path))
|
|
| 35 |
+ |
|
| 36 |
+ err = processUtilityImage(path) |
|
| 19 | 37 |
if err != nil {
|
| 20 |
- return &os.PathError{Op: "ProcessUtilityVMImage", Path: path, Err: err}
|
|
| 38 |
+ return &os.PathError{Op: title, Path: path, Err: err}
|
|
| 21 | 39 |
} |
| 22 | 40 |
return nil |
| 23 | 41 |
} |
| ... | ... |
@@ -1,26 +1,21 @@ |
| 1 | 1 |
package wclayer |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "context" |
|
| 5 |
+ |
|
| 4 | 6 |
"github.com/Microsoft/hcsshim/internal/hcserror" |
| 5 |
- "github.com/sirupsen/logrus" |
|
| 7 |
+ "github.com/Microsoft/hcsshim/internal/oc" |
|
| 8 |
+ "go.opencensus.io/trace" |
|
| 6 | 9 |
) |
| 7 | 10 |
|
| 8 | 11 |
// UnprepareLayer disables the filesystem filter for the read-write layer with |
| 9 | 12 |
// the given id. |
| 10 |
-func UnprepareLayer(path string) (err error) {
|
|
| 13 |
+func UnprepareLayer(ctx context.Context, path string) (err error) {
|
|
| 11 | 14 |
title := "hcsshim::UnprepareLayer" |
| 12 |
- fields := logrus.Fields{
|
|
| 13 |
- "path": path, |
|
| 14 |
- } |
|
| 15 |
- logrus.WithFields(fields).Debug(title) |
|
| 16 |
- defer func() {
|
|
| 17 |
- if err != nil {
|
|
| 18 |
- fields[logrus.ErrorKey] = err |
|
| 19 |
- logrus.WithFields(fields).Error(err) |
|
| 20 |
- } else {
|
|
| 21 |
- logrus.WithFields(fields).Debug(title + " - succeeded") |
|
| 22 |
- } |
|
| 23 |
- }() |
|
| 15 |
+ ctx, span := trace.StartSpan(ctx, title) |
|
| 16 |
+ defer span.End() |
|
| 17 |
+ defer func() { oc.SetSpanStatus(span, err) }()
|
|
| 18 |
+ span.AddAttributes(trace.StringAttribute("path", path))
|
|
| 24 | 19 |
|
| 25 | 20 |
err = unprepareLayer(&stdDriverInfo, path) |
| 26 | 21 |
if err != nil {
|
| ... | ... |
@@ -1,6 +1,7 @@ |
| 1 | 1 |
package hcsshim |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "context" |
|
| 4 | 5 |
"crypto/sha1" |
| 5 | 6 |
"path/filepath" |
| 6 | 7 |
|
| ... | ... |
@@ -13,59 +14,59 @@ func layerPath(info *DriverInfo, id string) string {
|
| 13 | 13 |
} |
| 14 | 14 |
|
| 15 | 15 |
func ActivateLayer(info DriverInfo, id string) error {
|
| 16 |
- return wclayer.ActivateLayer(layerPath(&info, id)) |
|
| 16 |
+ return wclayer.ActivateLayer(context.Background(), layerPath(&info, id)) |
|
| 17 | 17 |
} |
| 18 | 18 |
func CreateLayer(info DriverInfo, id, parent string) error {
|
| 19 |
- return wclayer.CreateLayer(layerPath(&info, id), parent) |
|
| 19 |
+ return wclayer.CreateLayer(context.Background(), layerPath(&info, id), parent) |
|
| 20 | 20 |
} |
| 21 | 21 |
|
| 22 | 22 |
// New clients should use CreateScratchLayer instead. Kept in to preserve API compatibility. |
| 23 | 23 |
func CreateSandboxLayer(info DriverInfo, layerId, parentId string, parentLayerPaths []string) error {
|
| 24 |
- return wclayer.CreateScratchLayer(layerPath(&info, layerId), parentLayerPaths) |
|
| 24 |
+ return wclayer.CreateScratchLayer(context.Background(), layerPath(&info, layerId), parentLayerPaths) |
|
| 25 | 25 |
} |
| 26 | 26 |
func CreateScratchLayer(info DriverInfo, layerId, parentId string, parentLayerPaths []string) error {
|
| 27 |
- return wclayer.CreateScratchLayer(layerPath(&info, layerId), parentLayerPaths) |
|
| 27 |
+ return wclayer.CreateScratchLayer(context.Background(), layerPath(&info, layerId), parentLayerPaths) |
|
| 28 | 28 |
} |
| 29 | 29 |
func DeactivateLayer(info DriverInfo, id string) error {
|
| 30 |
- return wclayer.DeactivateLayer(layerPath(&info, id)) |
|
| 30 |
+ return wclayer.DeactivateLayer(context.Background(), layerPath(&info, id)) |
|
| 31 | 31 |
} |
| 32 | 32 |
func DestroyLayer(info DriverInfo, id string) error {
|
| 33 |
- return wclayer.DestroyLayer(layerPath(&info, id)) |
|
| 33 |
+ return wclayer.DestroyLayer(context.Background(), layerPath(&info, id)) |
|
| 34 | 34 |
} |
| 35 | 35 |
|
| 36 | 36 |
// New clients should use ExpandScratchSize instead. Kept in to preserve API compatibility. |
| 37 | 37 |
func ExpandSandboxSize(info DriverInfo, layerId string, size uint64) error {
|
| 38 |
- return wclayer.ExpandScratchSize(layerPath(&info, layerId), size) |
|
| 38 |
+ return wclayer.ExpandScratchSize(context.Background(), layerPath(&info, layerId), size) |
|
| 39 | 39 |
} |
| 40 | 40 |
func ExpandScratchSize(info DriverInfo, layerId string, size uint64) error {
|
| 41 |
- return wclayer.ExpandScratchSize(layerPath(&info, layerId), size) |
|
| 41 |
+ return wclayer.ExpandScratchSize(context.Background(), layerPath(&info, layerId), size) |
|
| 42 | 42 |
} |
| 43 | 43 |
func ExportLayer(info DriverInfo, layerId string, exportFolderPath string, parentLayerPaths []string) error {
|
| 44 |
- return wclayer.ExportLayer(layerPath(&info, layerId), exportFolderPath, parentLayerPaths) |
|
| 44 |
+ return wclayer.ExportLayer(context.Background(), layerPath(&info, layerId), exportFolderPath, parentLayerPaths) |
|
| 45 | 45 |
} |
| 46 | 46 |
func GetLayerMountPath(info DriverInfo, id string) (string, error) {
|
| 47 |
- return wclayer.GetLayerMountPath(layerPath(&info, id)) |
|
| 47 |
+ return wclayer.GetLayerMountPath(context.Background(), layerPath(&info, id)) |
|
| 48 | 48 |
} |
| 49 | 49 |
func GetSharedBaseImages() (imageData string, err error) {
|
| 50 |
- return wclayer.GetSharedBaseImages() |
|
| 50 |
+ return wclayer.GetSharedBaseImages(context.Background()) |
|
| 51 | 51 |
} |
| 52 | 52 |
func ImportLayer(info DriverInfo, layerID string, importFolderPath string, parentLayerPaths []string) error {
|
| 53 |
- return wclayer.ImportLayer(layerPath(&info, layerID), importFolderPath, parentLayerPaths) |
|
| 53 |
+ return wclayer.ImportLayer(context.Background(), layerPath(&info, layerID), importFolderPath, parentLayerPaths) |
|
| 54 | 54 |
} |
| 55 | 55 |
func LayerExists(info DriverInfo, id string) (bool, error) {
|
| 56 |
- return wclayer.LayerExists(layerPath(&info, id)) |
|
| 56 |
+ return wclayer.LayerExists(context.Background(), layerPath(&info, id)) |
|
| 57 | 57 |
} |
| 58 | 58 |
func PrepareLayer(info DriverInfo, layerId string, parentLayerPaths []string) error {
|
| 59 |
- return wclayer.PrepareLayer(layerPath(&info, layerId), parentLayerPaths) |
|
| 59 |
+ return wclayer.PrepareLayer(context.Background(), layerPath(&info, layerId), parentLayerPaths) |
|
| 60 | 60 |
} |
| 61 | 61 |
func ProcessBaseLayer(path string) error {
|
| 62 |
- return wclayer.ProcessBaseLayer(path) |
|
| 62 |
+ return wclayer.ProcessBaseLayer(context.Background(), path) |
|
| 63 | 63 |
} |
| 64 | 64 |
func ProcessUtilityVMImage(path string) error {
|
| 65 |
- return wclayer.ProcessUtilityVMImage(path) |
|
| 65 |
+ return wclayer.ProcessUtilityVMImage(context.Background(), path) |
|
| 66 | 66 |
} |
| 67 | 67 |
func UnprepareLayer(info DriverInfo, layerId string) error {
|
| 68 |
- return wclayer.UnprepareLayer(layerPath(&info, layerId)) |
|
| 68 |
+ return wclayer.UnprepareLayer(context.Background(), layerPath(&info, layerId)) |
|
| 69 | 69 |
} |
| 70 | 70 |
|
| 71 | 71 |
type DriverInfo struct {
|
| ... | ... |
@@ -76,7 +77,7 @@ type DriverInfo struct {
|
| 76 | 76 |
type GUID [16]byte |
| 77 | 77 |
|
| 78 | 78 |
func NameToGuid(name string) (id GUID, err error) {
|
| 79 |
- g, err := wclayer.NameToGuid(name) |
|
| 79 |
+ g, err := wclayer.NameToGuid(context.Background(), name) |
|
| 80 | 80 |
return g.ToWindowsArray(), err |
| 81 | 81 |
} |
| 82 | 82 |
|
| ... | ... |
@@ -94,13 +95,13 @@ func (g *GUID) ToString() string {
|
| 94 | 94 |
type LayerReader = wclayer.LayerReader |
| 95 | 95 |
|
| 96 | 96 |
func NewLayerReader(info DriverInfo, layerID string, parentLayerPaths []string) (LayerReader, error) {
|
| 97 |
- return wclayer.NewLayerReader(layerPath(&info, layerID), parentLayerPaths) |
|
| 97 |
+ return wclayer.NewLayerReader(context.Background(), layerPath(&info, layerID), parentLayerPaths) |
|
| 98 | 98 |
} |
| 99 | 99 |
|
| 100 | 100 |
type LayerWriter = wclayer.LayerWriter |
| 101 | 101 |
|
| 102 | 102 |
func NewLayerWriter(info DriverInfo, layerID string, parentLayerPaths []string) (LayerWriter, error) {
|
| 103 |
- return wclayer.NewLayerWriter(layerPath(&info, layerID), parentLayerPaths) |
|
| 103 |
+ return wclayer.NewLayerWriter(context.Background(), layerPath(&info, layerID), parentLayerPaths) |
|
| 104 | 104 |
} |
| 105 | 105 |
|
| 106 | 106 |
type WC_LAYER_DESCRIPTOR = wclayer.WC_LAYER_DESCRIPTOR |