...
1
2
3 package computestorage
4
5 import (
6 "context"
7 "encoding/json"
8
9 "github.com/Microsoft/hcsshim/internal/oc"
10 "github.com/pkg/errors"
11 "go.opencensus.io/trace"
12 )
13
14
15
16
17
18
19
20 func InitializeWritableLayer(ctx context.Context, layerPath string, layerData LayerData) (err error) {
21 title := "hcsshim::InitializeWritableLayer"
22 ctx, span := oc.StartSpan(ctx, title)
23 defer span.End()
24 defer func() { oc.SetSpanStatus(span, err) }()
25 span.AddAttributes(
26 trace.StringAttribute("layerPath", layerPath),
27 )
28
29 bytes, err := json.Marshal(layerData)
30 if err != nil {
31 return err
32 }
33
34
35 err = hcsInitializeWritableLayer(layerPath, string(bytes), "")
36 if err != nil {
37 return errors.Wrap(err, "failed to intitialize container layer")
38 }
39 return nil
40 }
41
View as plain text