summaryrefslogtreecommitdiff
path: root/vendor/github.com/Microsoft/hcsshim/internal/hcs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/Microsoft/hcsshim/internal/hcs')
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/hcs/callback.go1
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/hcs/errors.go7
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/hcs/system.go32
3 files changed, 40 insertions, 0 deletions
diff --git a/vendor/github.com/Microsoft/hcsshim/internal/hcs/callback.go b/vendor/github.com/Microsoft/hcsshim/internal/hcs/callback.go
index 62ba81751..cebbe75ad 100644
--- a/vendor/github.com/Microsoft/hcsshim/internal/hcs/callback.go
+++ b/vendor/github.com/Microsoft/hcsshim/internal/hcs/callback.go
@@ -106,6 +106,7 @@ func newSystemChannels() notificationChannels {
hcsNotificationSystemStartCompleted,
hcsNotificationSystemPauseCompleted,
hcsNotificationSystemResumeCompleted,
+ hcsNotificationSystemSaveCompleted,
} {
channels[notif] = make(notificationChannel, 1)
}
diff --git a/vendor/github.com/Microsoft/hcsshim/internal/hcs/errors.go b/vendor/github.com/Microsoft/hcsshim/internal/hcs/errors.go
index 9a4705a49..bca824b8e 100644
--- a/vendor/github.com/Microsoft/hcsshim/internal/hcs/errors.go
+++ b/vendor/github.com/Microsoft/hcsshim/internal/hcs/errors.go
@@ -312,6 +312,13 @@ func IsOperationInvalidState(err error) bool {
return err == ErrVmcomputeOperationInvalidState
}
+// IsAccessIsDenied returns true when err is caused by
+// `ErrVmcomputeOperationAccessIsDenied`.
+func IsAccessIsDenied(err error) bool {
+ err = getInnerError(err)
+ return err == ErrVmcomputeOperationAccessIsDenied
+}
+
func getInnerError(err error) error {
switch pe := err.(type) {
case nil:
diff --git a/vendor/github.com/Microsoft/hcsshim/internal/hcs/system.go b/vendor/github.com/Microsoft/hcsshim/internal/hcs/system.go
index 6120399c4..bda393a6d 100644
--- a/vendor/github.com/Microsoft/hcsshim/internal/hcs/system.go
+++ b/vendor/github.com/Microsoft/hcsshim/internal/hcs/system.go
@@ -407,6 +407,38 @@ func (computeSystem *System) Resume(ctx context.Context) (err error) {
return nil
}
+// Save the compute system
+func (computeSystem *System) Save(ctx context.Context, options interface{}) (err error) {
+ operation := "hcsshim::System::Save"
+
+ // hcsSaveComputeSystemContext is an async peration. Start the outer span
+ // here to measure the full save time.
+ ctx, span := trace.StartSpan(ctx, operation)
+ defer span.End()
+ defer func() { oc.SetSpanStatus(span, err) }()
+ span.AddAttributes(trace.StringAttribute("cid", computeSystem.id))
+
+ saveOptions, err := json.Marshal(options)
+ if err != nil {
+ return err
+ }
+
+ computeSystem.handleLock.RLock()
+ defer computeSystem.handleLock.RUnlock()
+
+ if computeSystem.handle == 0 {
+ return makeSystemError(computeSystem, operation, "", ErrAlreadyClosed, nil)
+ }
+
+ result, err := vmcompute.HcsSaveComputeSystem(ctx, computeSystem.handle, string(saveOptions))
+ events, err := processAsyncHcsResult(ctx, err, result, computeSystem.callbackNumber, hcsNotificationSystemSaveCompleted, &timeout.SystemSave)
+ if err != nil {
+ return makeSystemError(computeSystem, operation, "", err, events)
+ }
+
+ return nil
+}
+
func (computeSystem *System) createProcess(ctx context.Context, operation string, c interface{}) (*Process, *vmcompute.HcsProcessInformation, error) {
computeSystem.handleLock.RLock()
defer computeSystem.handleLock.RUnlock()