k3s/vendor/github.com/Microsoft/hcsshim/internal/wclayer/processimage.go

42 lines
1.2 KiB
Go
Raw Normal View History

2019-01-12 04:58:27 +00:00
package wclayer
2020-08-10 17:43:49 +00:00
import (
"context"
"os"
"github.com/Microsoft/hcsshim/internal/oc"
"go.opencensus.io/trace"
)
2019-01-12 04:58:27 +00:00
// ProcessBaseLayer post-processes a base layer that has had its files extracted.
// The files should have been extracted to <path>\Files.
2020-08-10 17:43:49 +00:00
func ProcessBaseLayer(ctx context.Context, path string) (err error) {
title := "hcsshim::ProcessBaseLayer"
ctx, span := trace.StartSpan(ctx, title) //nolint:ineffassign,staticcheck
2020-08-10 17:43:49 +00:00
defer span.End()
defer func() { oc.SetSpanStatus(span, err) }()
span.AddAttributes(trace.StringAttribute("path", path))
err = processBaseImage(path)
2019-01-12 04:58:27 +00:00
if err != nil {
2020-08-10 17:43:49 +00:00
return &os.PathError{Op: title, Path: path, Err: err}
2019-01-12 04:58:27 +00:00
}
return nil
}
// ProcessUtilityVMImage post-processes a utility VM image that has had its files extracted.
// The files should have been extracted to <path>\Files.
2020-08-10 17:43:49 +00:00
func ProcessUtilityVMImage(ctx context.Context, path string) (err error) {
title := "hcsshim::ProcessUtilityVMImage"
ctx, span := trace.StartSpan(ctx, title) //nolint:ineffassign,staticcheck
2020-08-10 17:43:49 +00:00
defer span.End()
defer func() { oc.SetSpanStatus(span, err) }()
span.AddAttributes(trace.StringAttribute("path", path))
err = processUtilityImage(path)
2019-01-12 04:58:27 +00:00
if err != nil {
2020-08-10 17:43:49 +00:00
return &os.PathError{Op: title, Path: path, Err: err}
2019-01-12 04:58:27 +00:00
}
return nil
}