...

Source file src/github.com/Microsoft/hcsshim/internal/wclayer/grantvmaccess.go

Documentation: github.com/Microsoft/hcsshim/internal/wclayer

     1  //go:build windows
     2  
     3  package wclayer
     4  
     5  import (
     6  	"context"
     7  
     8  	"github.com/Microsoft/hcsshim/internal/hcserror"
     9  	"github.com/Microsoft/hcsshim/internal/oc"
    10  	"go.opencensus.io/trace"
    11  )
    12  
    13  // GrantVmAccess adds access to a file for a given VM
    14  func GrantVmAccess(ctx context.Context, vmid string, filepath string) (err error) {
    15  	title := "hcsshim::GrantVmAccess"
    16  	ctx, span := oc.StartSpan(ctx, title) //nolint:ineffassign,staticcheck
    17  	defer span.End()
    18  	defer func() { oc.SetSpanStatus(span, err) }()
    19  	span.AddAttributes(
    20  		trace.StringAttribute("vm-id", vmid),
    21  		trace.StringAttribute("path", filepath))
    22  
    23  	err = grantVmAccess(vmid, filepath)
    24  	if err != nil {
    25  		return hcserror.New(err, title, "")
    26  	}
    27  	return nil
    28  }
    29  

View as plain text