activatelayer.go 896 B

1234567891011121314151617181920212223242526272829
  1. //go:build windows
  2. package wclayer
  3. import (
  4. "context"
  5. "github.com/Microsoft/hcsshim/internal/hcserror"
  6. "github.com/Microsoft/hcsshim/internal/oc"
  7. "go.opencensus.io/trace"
  8. )
  9. // ActivateLayer will find the layer with the given id and mount it's filesystem.
  10. // For a read/write layer, the mounted filesystem will appear as a volume on the
  11. // host, while a read-only layer is generally expected to be a no-op.
  12. // An activated layer must later be deactivated via DeactivateLayer.
  13. func ActivateLayer(ctx context.Context, path string) (err error) {
  14. title := "hcsshim::ActivateLayer"
  15. ctx, span := oc.StartSpan(ctx, title) //nolint:ineffassign,staticcheck
  16. defer span.End()
  17. defer func() { oc.SetSpanStatus(span, err) }()
  18. span.AddAttributes(trace.StringAttribute("path", path))
  19. err = activateLayer(&stdDriverInfo, path)
  20. if err != nil {
  21. return hcserror.New(err, title, "")
  22. }
  23. return nil
  24. }