Revendor hcsshim to v0.3.2
Signed-off-by: Darren Stahl <darst@microsoft.com>
This commit is contained in:
parent
6717b35503
commit
bb1c54bc1f
8 changed files with 86 additions and 7 deletions
|
@ -43,7 +43,7 @@ esac
|
|||
|
||||
# the following lines are in sorted order, FYI
|
||||
clone git github.com/Azure/go-ansiterm 388960b655244e76e24c75f48631564eaefade62
|
||||
clone git github.com/Microsoft/hcsshim v0.3.1
|
||||
clone git github.com/Microsoft/hcsshim v0.3.2
|
||||
clone git github.com/Microsoft/go-winio v0.3.4
|
||||
clone git github.com/Sirupsen/logrus v0.10.0 # logrus is a common dependency among multiple deps
|
||||
clone git github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a
|
||||
|
|
|
@ -82,6 +82,9 @@ func CreateContainer(id string, c *ContainerConfig) (Container, error) {
|
|||
|
||||
err = processAsyncHcsResult(createError, resultp, container.callbackNumber, hcsNotificationSystemCreateCompleted, &defaultTimeout)
|
||||
if err != nil {
|
||||
if err == ErrTimeout || err == ErrUnexpectedProcessAbort || err == ErrUnexpectedContainerExit {
|
||||
return nil, err
|
||||
}
|
||||
err := &ContainerError{Container: container, Operation: operation, ExtraInfo: configuration, Err: err}
|
||||
logrus.Error(err)
|
||||
return nil, err
|
||||
|
@ -131,6 +134,9 @@ func (container *container) Start() error {
|
|||
err := hcsStartComputeSystemTP5(container.handle, nil, &resultp)
|
||||
err = processAsyncHcsResult(err, resultp, container.callbackNumber, hcsNotificationSystemStartCompleted, &defaultTimeout)
|
||||
if err != nil {
|
||||
if err == ErrTimeout || err == ErrUnexpectedProcessAbort || err == ErrUnexpectedContainerExit {
|
||||
return err
|
||||
}
|
||||
err := &ContainerError{Container: container, Operation: operation, Err: err}
|
||||
logrus.Error(err)
|
||||
return err
|
||||
|
@ -195,6 +201,9 @@ func (container *container) Wait() error {
|
|||
if hcsCallbacksSupported {
|
||||
err := waitForNotification(container.callbackNumber, hcsNotificationSystemExited, nil)
|
||||
if err != nil {
|
||||
if err == ErrUnexpectedProcessAbort || err == ErrUnexpectedContainerExit {
|
||||
return err
|
||||
}
|
||||
err := &ContainerError{Container: container, Operation: operation, Err: err}
|
||||
logrus.Error(err)
|
||||
return err
|
||||
|
@ -225,9 +234,10 @@ func (container *container) WaitTimeout(timeout time.Duration) error {
|
|||
|
||||
if hcsCallbacksSupported {
|
||||
err := waitForNotification(container.callbackNumber, hcsNotificationSystemExited, &timeout)
|
||||
if err == ErrTimeout {
|
||||
return ErrTimeout
|
||||
} else if err != nil {
|
||||
if err != nil {
|
||||
if err == ErrTimeout || err == ErrUnexpectedProcessAbort || err == ErrUnexpectedContainerExit {
|
||||
return err
|
||||
}
|
||||
err := &ContainerError{Container: container, Operation: operation, Err: err}
|
||||
logrus.Error(err)
|
||||
return err
|
||||
|
@ -313,6 +323,9 @@ func (container *container) Pause() error {
|
|||
err := hcsPauseComputeSystemTP5(container.handle, nil, &resultp)
|
||||
err = processAsyncHcsResult(err, resultp, container.callbackNumber, hcsNotificationSystemPauseCompleted, &defaultTimeout)
|
||||
if err != nil {
|
||||
if err == ErrTimeout || err == ErrUnexpectedProcessAbort || err == ErrUnexpectedContainerExit {
|
||||
return err
|
||||
}
|
||||
err := &ContainerError{Container: container, Operation: operation, Err: err}
|
||||
logrus.Error(err)
|
||||
return err
|
||||
|
@ -334,6 +347,9 @@ func (container *container) Resume() error {
|
|||
err := hcsResumeComputeSystemTP5(container.handle, nil, &resultp)
|
||||
err = processAsyncHcsResult(err, resultp, container.callbackNumber, hcsNotificationSystemResumeCompleted, &defaultTimeout)
|
||||
if err != nil {
|
||||
if err == ErrTimeout || err == ErrUnexpectedProcessAbort || err == ErrUnexpectedContainerExit {
|
||||
return err
|
||||
}
|
||||
err := &ContainerError{Container: container, Operation: operation, Err: err}
|
||||
logrus.Error(err)
|
||||
return err
|
||||
|
|
26
vendor/src/github.com/Microsoft/hcsshim/expandsandboxsize.go
vendored
Normal file
26
vendor/src/github.com/Microsoft/hcsshim/expandsandboxsize.go
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
package hcsshim
|
||||
|
||||
import "github.com/Sirupsen/logrus"
|
||||
|
||||
// ExpandSandboxSize expands the size of a layer to at least size bytes.
|
||||
func ExpandSandboxSize(info DriverInfo, layerId string, size uint64) error {
|
||||
title := "hcsshim::ExpandSandboxSize "
|
||||
logrus.Debugf(title+"layerId=%s size=%d", layerId, size)
|
||||
|
||||
// Convert info to API calling convention
|
||||
infop, err := convertDriverInfo(info)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
return err
|
||||
}
|
||||
|
||||
err = expandSandboxSize(&infop, layerId, size)
|
||||
if err != nil {
|
||||
err = makeErrorf(err, title, "layerId=%s size=%d", layerId, size)
|
||||
logrus.Error(err)
|
||||
return err
|
||||
}
|
||||
|
||||
logrus.Debugf(title+"- succeeded layerId=%s size=%d", layerId, size)
|
||||
return nil
|
||||
}
|
|
@ -19,6 +19,7 @@ import (
|
|||
//sys copyLayer(info *driverInfo, srcId string, dstId string, descriptors []WC_LAYER_DESCRIPTOR) (hr error) = vmcompute.CopyLayer?
|
||||
//sys createLayer(info *driverInfo, id string, parent string) (hr error) = vmcompute.CreateLayer?
|
||||
//sys createSandboxLayer(info *driverInfo, id string, parent string, descriptors []WC_LAYER_DESCRIPTOR) (hr error) = vmcompute.CreateSandboxLayer?
|
||||
//sys expandSandboxSize(info *driverInfo, id string, size uint64) (hr error) = vmcompute.ExpandSandboxSize?
|
||||
//sys deactivateLayer(info *driverInfo, id string) (hr error) = vmcompute.DeactivateLayer?
|
||||
//sys destroyLayer(info *driverInfo, id string) (hr error) = vmcompute.DestroyLayer?
|
||||
//sys exportLayer(info *driverInfo, id string, path string, descriptors []WC_LAYER_DESCRIPTOR) (hr error) = vmcompute.ExportLayer?
|
||||
|
|
|
@ -20,6 +20,16 @@ type QosPolicy struct {
|
|||
MaximumOutgoingBandwidthInBytes uint64
|
||||
}
|
||||
|
||||
type VlanPolicy struct {
|
||||
Type string
|
||||
VLAN uint
|
||||
}
|
||||
|
||||
type VsidPolicy struct {
|
||||
Type string
|
||||
VSID uint
|
||||
}
|
||||
|
||||
// Subnet is assoicated with a network and represents a list
|
||||
// of subnets available to the network
|
||||
type Subnet struct {
|
||||
|
|
|
@ -46,6 +46,7 @@ type ContainerConfig struct {
|
|||
IgnoreFlushesDuringBoot bool // Optimization hint for container startup in Windows
|
||||
LayerFolderPath string // Where the layer folders are located
|
||||
Layers []Layer // List of storage layers
|
||||
Credentials string `json:",omitempty"` // Credentials information
|
||||
ProcessorWeight uint64 `json:",omitempty"` // CPU Shares 0..10000 on Windows; where 0 will be omitted and HCS will default.
|
||||
ProcessorMaximum int64 `json:",omitempty"` // CPU maximum usage percent 1..100
|
||||
StorageIOPSMaximum uint64 `json:",omitempty"` // Maximum Storage IOPS
|
||||
|
|
|
@ -103,6 +103,9 @@ func (process *process) Wait() error {
|
|||
if hcsCallbacksSupported {
|
||||
err := waitForNotification(process.callbackNumber, hcsNotificationProcessExited, nil)
|
||||
if err != nil {
|
||||
if err == ErrUnexpectedProcessAbort || err == ErrUnexpectedContainerExit {
|
||||
return err
|
||||
}
|
||||
err := &ProcessError{Operation: operation, Process: process, Err: err}
|
||||
logrus.Error(err)
|
||||
return err
|
||||
|
@ -129,9 +132,10 @@ func (process *process) WaitTimeout(timeout time.Duration) error {
|
|||
|
||||
if hcsCallbacksSupported {
|
||||
err := waitForNotification(process.callbackNumber, hcsNotificationProcessExited, &timeout)
|
||||
if err == ErrTimeout {
|
||||
return ErrTimeout
|
||||
} else if err != nil {
|
||||
if err != nil {
|
||||
if err == ErrTimeout || err == ErrUnexpectedProcessAbort || err == ErrUnexpectedContainerExit {
|
||||
return err
|
||||
}
|
||||
err := &ProcessError{Operation: operation, Process: process, Err: err}
|
||||
logrus.Error(err)
|
||||
return err
|
||||
|
|
|
@ -17,6 +17,7 @@ var (
|
|||
procCopyLayer = modvmcompute.NewProc("CopyLayer")
|
||||
procCreateLayer = modvmcompute.NewProc("CreateLayer")
|
||||
procCreateSandboxLayer = modvmcompute.NewProc("CreateSandboxLayer")
|
||||
procExpandSandboxSize = modvmcompute.NewProc("ExpandSandboxSize")
|
||||
procDeactivateLayer = modvmcompute.NewProc("DeactivateLayer")
|
||||
procDestroyLayer = modvmcompute.NewProc("DestroyLayer")
|
||||
procExportLayer = modvmcompute.NewProc("ExportLayer")
|
||||
|
@ -184,6 +185,26 @@ func _createSandboxLayer(info *driverInfo, id *uint16, parent *uint16, descripto
|
|||
return
|
||||
}
|
||||
|
||||
func expandSandboxSize(info *driverInfo, id string, size uint64) (hr error) {
|
||||
var _p0 *uint16
|
||||
_p0, hr = syscall.UTF16PtrFromString(id)
|
||||
if hr != nil {
|
||||
return
|
||||
}
|
||||
return _expandSandboxSize(info, _p0, size)
|
||||
}
|
||||
|
||||
func _expandSandboxSize(info *driverInfo, id *uint16, size uint64) (hr error) {
|
||||
if hr = procExpandSandboxSize.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procExpandSandboxSize.Addr(), 3, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), uintptr(size))
|
||||
if int32(r0) < 0 {
|
||||
hr = syscall.Errno(win32FromHresult(r0))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func deactivateLayer(info *driverInfo, id string) (hr error) {
|
||||
var _p0 *uint16
|
||||
_p0, hr = syscall.UTF16PtrFromString(id)
|
||||
|
|
Loading…
Reference in a new issue