aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/Microsoft/hcsshim/internal/hcs/system.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/Microsoft/hcsshim/internal/hcs/system.go')
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/hcs/system.go32
1 files changed, 32 insertions, 0 deletions
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()