...
1
2
3 package wclayer
4
5 import (
6 "context"
7 "strings"
8
9 "github.com/Microsoft/hcsshim/internal/hcserror"
10 "github.com/Microsoft/hcsshim/internal/oc"
11 "go.opencensus.io/trace"
12 )
13
14
15
16 func CreateScratchLayer(ctx context.Context, path string, parentLayerPaths []string) (err error) {
17 title := "hcsshim::CreateScratchLayer"
18 ctx, span := oc.StartSpan(ctx, title)
19 defer span.End()
20 defer func() { oc.SetSpanStatus(span, err) }()
21 span.AddAttributes(
22 trace.StringAttribute("path", path),
23 trace.StringAttribute("parentLayerPaths", strings.Join(parentLayerPaths, ", ")))
24
25
26 layers, err := layerPathsToDescriptors(ctx, parentLayerPaths)
27 if err != nil {
28 return err
29 }
30
31 err = createSandboxLayer(&stdDriverInfo, path, 0, layers)
32 if err != nil {
33 return hcserror.New(err, title, "")
34 }
35 return nil
36 }
37
View as plain text