Signed-off-by: Darren Stahl <darst@microsoft.com>
| ... | ... |
@@ -43,7 +43,7 @@ esac |
| 43 | 43 |
|
| 44 | 44 |
# the following lines are in sorted order, FYI |
| 45 | 45 |
clone git github.com/Azure/go-ansiterm 388960b655244e76e24c75f48631564eaefade62 |
| 46 |
-clone git github.com/Microsoft/hcsshim v0.3.1 |
|
| 46 |
+clone git github.com/Microsoft/hcsshim v0.3.2 |
|
| 47 | 47 |
clone git github.com/Microsoft/go-winio v0.3.4 |
| 48 | 48 |
clone git github.com/Sirupsen/logrus v0.10.0 # logrus is a common dependency among multiple deps |
| 49 | 49 |
clone git github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a |
| ... | ... |
@@ -82,6 +82,9 @@ func CreateContainer(id string, c *ContainerConfig) (Container, error) {
|
| 82 | 82 |
|
| 83 | 83 |
err = processAsyncHcsResult(createError, resultp, container.callbackNumber, hcsNotificationSystemCreateCompleted, &defaultTimeout) |
| 84 | 84 |
if err != nil {
|
| 85 |
+ if err == ErrTimeout || err == ErrUnexpectedProcessAbort || err == ErrUnexpectedContainerExit {
|
|
| 86 |
+ return nil, err |
|
| 87 |
+ } |
|
| 85 | 88 |
err := &ContainerError{Container: container, Operation: operation, ExtraInfo: configuration, Err: err}
|
| 86 | 89 |
logrus.Error(err) |
| 87 | 90 |
return nil, err |
| ... | ... |
@@ -131,6 +134,9 @@ func (container *container) Start() error {
|
| 131 | 131 |
err := hcsStartComputeSystemTP5(container.handle, nil, &resultp) |
| 132 | 132 |
err = processAsyncHcsResult(err, resultp, container.callbackNumber, hcsNotificationSystemStartCompleted, &defaultTimeout) |
| 133 | 133 |
if err != nil {
|
| 134 |
+ if err == ErrTimeout || err == ErrUnexpectedProcessAbort || err == ErrUnexpectedContainerExit {
|
|
| 135 |
+ return err |
|
| 136 |
+ } |
|
| 134 | 137 |
err := &ContainerError{Container: container, Operation: operation, Err: err}
|
| 135 | 138 |
logrus.Error(err) |
| 136 | 139 |
return err |
| ... | ... |
@@ -195,6 +201,9 @@ func (container *container) Wait() error {
|
| 195 | 195 |
if hcsCallbacksSupported {
|
| 196 | 196 |
err := waitForNotification(container.callbackNumber, hcsNotificationSystemExited, nil) |
| 197 | 197 |
if err != nil {
|
| 198 |
+ if err == ErrUnexpectedProcessAbort || err == ErrUnexpectedContainerExit {
|
|
| 199 |
+ return err |
|
| 200 |
+ } |
|
| 198 | 201 |
err := &ContainerError{Container: container, Operation: operation, Err: err}
|
| 199 | 202 |
logrus.Error(err) |
| 200 | 203 |
return err |
| ... | ... |
@@ -225,9 +234,10 @@ func (container *container) WaitTimeout(timeout time.Duration) error {
|
| 225 | 225 |
|
| 226 | 226 |
if hcsCallbacksSupported {
|
| 227 | 227 |
err := waitForNotification(container.callbackNumber, hcsNotificationSystemExited, &timeout) |
| 228 |
- if err == ErrTimeout {
|
|
| 229 |
- return ErrTimeout |
|
| 230 |
- } else if err != nil {
|
|
| 228 |
+ if err != nil {
|
|
| 229 |
+ if err == ErrTimeout || err == ErrUnexpectedProcessAbort || err == ErrUnexpectedContainerExit {
|
|
| 230 |
+ return err |
|
| 231 |
+ } |
|
| 231 | 232 |
err := &ContainerError{Container: container, Operation: operation, Err: err}
|
| 232 | 233 |
logrus.Error(err) |
| 233 | 234 |
return err |
| ... | ... |
@@ -313,6 +323,9 @@ func (container *container) Pause() error {
|
| 313 | 313 |
err := hcsPauseComputeSystemTP5(container.handle, nil, &resultp) |
| 314 | 314 |
err = processAsyncHcsResult(err, resultp, container.callbackNumber, hcsNotificationSystemPauseCompleted, &defaultTimeout) |
| 315 | 315 |
if err != nil {
|
| 316 |
+ if err == ErrTimeout || err == ErrUnexpectedProcessAbort || err == ErrUnexpectedContainerExit {
|
|
| 317 |
+ return err |
|
| 318 |
+ } |
|
| 316 | 319 |
err := &ContainerError{Container: container, Operation: operation, Err: err}
|
| 317 | 320 |
logrus.Error(err) |
| 318 | 321 |
return err |
| ... | ... |
@@ -334,6 +347,9 @@ func (container *container) Resume() error {
|
| 334 | 334 |
err := hcsResumeComputeSystemTP5(container.handle, nil, &resultp) |
| 335 | 335 |
err = processAsyncHcsResult(err, resultp, container.callbackNumber, hcsNotificationSystemResumeCompleted, &defaultTimeout) |
| 336 | 336 |
if err != nil {
|
| 337 |
+ if err == ErrTimeout || err == ErrUnexpectedProcessAbort || err == ErrUnexpectedContainerExit {
|
|
| 338 |
+ return err |
|
| 339 |
+ } |
|
| 337 | 340 |
err := &ContainerError{Container: container, Operation: operation, Err: err}
|
| 338 | 341 |
logrus.Error(err) |
| 339 | 342 |
return err |
| 340 | 343 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 0 |
+package hcsshim |
|
| 1 |
+ |
|
| 2 |
+import "github.com/Sirupsen/logrus" |
|
| 3 |
+ |
|
| 4 |
+// ExpandSandboxSize expands the size of a layer to at least size bytes. |
|
| 5 |
+func ExpandSandboxSize(info DriverInfo, layerId string, size uint64) error {
|
|
| 6 |
+ title := "hcsshim::ExpandSandboxSize " |
|
| 7 |
+ logrus.Debugf(title+"layerId=%s size=%d", layerId, size) |
|
| 8 |
+ |
|
| 9 |
+ // Convert info to API calling convention |
|
| 10 |
+ infop, err := convertDriverInfo(info) |
|
| 11 |
+ if err != nil {
|
|
| 12 |
+ logrus.Error(err) |
|
| 13 |
+ return err |
|
| 14 |
+ } |
|
| 15 |
+ |
|
| 16 |
+ err = expandSandboxSize(&infop, layerId, size) |
|
| 17 |
+ if err != nil {
|
|
| 18 |
+ err = makeErrorf(err, title, "layerId=%s size=%d", layerId, size) |
|
| 19 |
+ logrus.Error(err) |
|
| 20 |
+ return err |
|
| 21 |
+ } |
|
| 22 |
+ |
|
| 23 |
+ logrus.Debugf(title+"- succeeded layerId=%s size=%d", layerId, size) |
|
| 24 |
+ return nil |
|
| 25 |
+} |
| ... | ... |
@@ -19,6 +19,7 @@ import ( |
| 19 | 19 |
//sys copyLayer(info *driverInfo, srcId string, dstId string, descriptors []WC_LAYER_DESCRIPTOR) (hr error) = vmcompute.CopyLayer? |
| 20 | 20 |
//sys createLayer(info *driverInfo, id string, parent string) (hr error) = vmcompute.CreateLayer? |
| 21 | 21 |
//sys createSandboxLayer(info *driverInfo, id string, parent string, descriptors []WC_LAYER_DESCRIPTOR) (hr error) = vmcompute.CreateSandboxLayer? |
| 22 |
+//sys expandSandboxSize(info *driverInfo, id string, size uint64) (hr error) = vmcompute.ExpandSandboxSize? |
|
| 22 | 23 |
//sys deactivateLayer(info *driverInfo, id string) (hr error) = vmcompute.DeactivateLayer? |
| 23 | 24 |
//sys destroyLayer(info *driverInfo, id string) (hr error) = vmcompute.DestroyLayer? |
| 24 | 25 |
//sys exportLayer(info *driverInfo, id string, path string, descriptors []WC_LAYER_DESCRIPTOR) (hr error) = vmcompute.ExportLayer? |
| ... | ... |
@@ -20,6 +20,16 @@ type QosPolicy struct {
|
| 20 | 20 |
MaximumOutgoingBandwidthInBytes uint64 |
| 21 | 21 |
} |
| 22 | 22 |
|
| 23 |
+type VlanPolicy struct {
|
|
| 24 |
+ Type string |
|
| 25 |
+ VLAN uint |
|
| 26 |
+} |
|
| 27 |
+ |
|
| 28 |
+type VsidPolicy struct {
|
|
| 29 |
+ Type string |
|
| 30 |
+ VSID uint |
|
| 31 |
+} |
|
| 32 |
+ |
|
| 23 | 33 |
// Subnet is assoicated with a network and represents a list |
| 24 | 34 |
// of subnets available to the network |
| 25 | 35 |
type Subnet struct {
|
| ... | ... |
@@ -46,6 +46,7 @@ type ContainerConfig struct {
|
| 46 | 46 |
IgnoreFlushesDuringBoot bool // Optimization hint for container startup in Windows |
| 47 | 47 |
LayerFolderPath string // Where the layer folders are located |
| 48 | 48 |
Layers []Layer // List of storage layers |
| 49 |
+ Credentials string `json:",omitempty"` // Credentials information |
|
| 49 | 50 |
ProcessorWeight uint64 `json:",omitempty"` // CPU Shares 0..10000 on Windows; where 0 will be omitted and HCS will default. |
| 50 | 51 |
ProcessorMaximum int64 `json:",omitempty"` // CPU maximum usage percent 1..100 |
| 51 | 52 |
StorageIOPSMaximum uint64 `json:",omitempty"` // Maximum Storage IOPS |
| ... | ... |
@@ -103,6 +103,9 @@ func (process *process) Wait() error {
|
| 103 | 103 |
if hcsCallbacksSupported {
|
| 104 | 104 |
err := waitForNotification(process.callbackNumber, hcsNotificationProcessExited, nil) |
| 105 | 105 |
if err != nil {
|
| 106 |
+ if err == ErrUnexpectedProcessAbort || err == ErrUnexpectedContainerExit {
|
|
| 107 |
+ return err |
|
| 108 |
+ } |
|
| 106 | 109 |
err := &ProcessError{Operation: operation, Process: process, Err: err}
|
| 107 | 110 |
logrus.Error(err) |
| 108 | 111 |
return err |
| ... | ... |
@@ -129,9 +132,10 @@ func (process *process) WaitTimeout(timeout time.Duration) error {
|
| 129 | 129 |
|
| 130 | 130 |
if hcsCallbacksSupported {
|
| 131 | 131 |
err := waitForNotification(process.callbackNumber, hcsNotificationProcessExited, &timeout) |
| 132 |
- if err == ErrTimeout {
|
|
| 133 |
- return ErrTimeout |
|
| 134 |
- } else if err != nil {
|
|
| 132 |
+ if err != nil {
|
|
| 133 |
+ if err == ErrTimeout || err == ErrUnexpectedProcessAbort || err == ErrUnexpectedContainerExit {
|
|
| 134 |
+ return err |
|
| 135 |
+ } |
|
| 135 | 136 |
err := &ProcessError{Operation: operation, Process: process, Err: err}
|
| 136 | 137 |
logrus.Error(err) |
| 137 | 138 |
return err |
| ... | ... |
@@ -17,6 +17,7 @@ var ( |
| 17 | 17 |
procCopyLayer = modvmcompute.NewProc("CopyLayer")
|
| 18 | 18 |
procCreateLayer = modvmcompute.NewProc("CreateLayer")
|
| 19 | 19 |
procCreateSandboxLayer = modvmcompute.NewProc("CreateSandboxLayer")
|
| 20 |
+ procExpandSandboxSize = modvmcompute.NewProc("ExpandSandboxSize")
|
|
| 20 | 21 |
procDeactivateLayer = modvmcompute.NewProc("DeactivateLayer")
|
| 21 | 22 |
procDestroyLayer = modvmcompute.NewProc("DestroyLayer")
|
| 22 | 23 |
procExportLayer = modvmcompute.NewProc("ExportLayer")
|
| ... | ... |
@@ -184,6 +185,26 @@ func _createSandboxLayer(info *driverInfo, id *uint16, parent *uint16, descripto |
| 184 | 184 |
return |
| 185 | 185 |
} |
| 186 | 186 |
|
| 187 |
+func expandSandboxSize(info *driverInfo, id string, size uint64) (hr error) {
|
|
| 188 |
+ var _p0 *uint16 |
|
| 189 |
+ _p0, hr = syscall.UTF16PtrFromString(id) |
|
| 190 |
+ if hr != nil {
|
|
| 191 |
+ return |
|
| 192 |
+ } |
|
| 193 |
+ return _expandSandboxSize(info, _p0, size) |
|
| 194 |
+} |
|
| 195 |
+ |
|
| 196 |
+func _expandSandboxSize(info *driverInfo, id *uint16, size uint64) (hr error) {
|
|
| 197 |
+ if hr = procExpandSandboxSize.Find(); hr != nil {
|
|
| 198 |
+ return |
|
| 199 |
+ } |
|
| 200 |
+ r0, _, _ := syscall.Syscall(procExpandSandboxSize.Addr(), 3, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), uintptr(size)) |
|
| 201 |
+ if int32(r0) < 0 {
|
|
| 202 |
+ hr = syscall.Errno(win32FromHresult(r0)) |
|
| 203 |
+ } |
|
| 204 |
+ return |
|
| 205 |
+} |
|
| 206 |
+ |
|
| 187 | 207 |
func deactivateLayer(info *driverInfo, id string) (hr error) {
|
| 188 | 208 |
var _p0 *uint16 |
| 189 | 209 |
_p0, hr = syscall.UTF16PtrFromString(id) |