...
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
21 func AttachLayerStorageFilter(ctx context.Context, layerPath string, layerData LayerData) (err error) {
22 title := "hcsshim::AttachLayerStorageFilter"
23 ctx, span := oc.StartSpan(ctx, title)
24 defer span.End()
25 defer func() { oc.SetSpanStatus(span, err) }()
26 span.AddAttributes(
27 trace.StringAttribute("layerPath", layerPath),
28 )
29
30 bytes, err := json.Marshal(layerData)
31 if err != nil {
32 return err
33 }
34
35 err = hcsAttachLayerStorageFilter(layerPath, string(bytes))
36 if err != nil {
37 return errors.Wrap(err, "failed to attach layer storage filter")
38 }
39 return nil
40 }
41
View as plain text