This contains quite a bit (also bumps google/uuid to 1.3.0). Some HostProcess container improvements to get ready for whenever it goes to stable in Kubernetes, Hyper-V (windows) container support for CRI, and a plethora of other small additions and fixes. Signed-off-by: Daniel Canter <dcanter@microsoft.com>
		
			
				
	
	
		
			44 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
//go:build windows
 | 
						|
 | 
						|
package computestorage
 | 
						|
 | 
						|
import (
 | 
						|
	"context"
 | 
						|
	"encoding/json"
 | 
						|
 | 
						|
	"github.com/Microsoft/hcsshim/internal/oc"
 | 
						|
	"github.com/pkg/errors"
 | 
						|
	"go.opencensus.io/trace"
 | 
						|
)
 | 
						|
 | 
						|
// ImportLayer imports a container layer.
 | 
						|
//
 | 
						|
// `layerPath` is a path to a directory to import the layer to. If the directory
 | 
						|
// does not exist it will be automatically created.
 | 
						|
//
 | 
						|
// `sourceFolderpath` is a pre-existing folder that contains the layer to
 | 
						|
// import.
 | 
						|
//
 | 
						|
// `layerData` is the parent layer data.
 | 
						|
func ImportLayer(ctx context.Context, layerPath, sourceFolderPath string, layerData LayerData) (err error) {
 | 
						|
	title := "hcsshim::ImportLayer"
 | 
						|
	ctx, span := oc.StartSpan(ctx, title) //nolint:ineffassign,staticcheck
 | 
						|
	defer span.End()
 | 
						|
	defer func() { oc.SetSpanStatus(span, err) }()
 | 
						|
	span.AddAttributes(
 | 
						|
		trace.StringAttribute("layerPath", layerPath),
 | 
						|
		trace.StringAttribute("sourceFolderPath", sourceFolderPath),
 | 
						|
	)
 | 
						|
 | 
						|
	bytes, err := json.Marshal(layerData)
 | 
						|
	if err != nil {
 | 
						|
		return err
 | 
						|
	}
 | 
						|
 | 
						|
	err = hcsImportLayer(layerPath, sourceFolderPath, string(bytes))
 | 
						|
	if err != nil {
 | 
						|
		return errors.Wrap(err, "failed to import layer")
 | 
						|
	}
 | 
						|
	return nil
 | 
						|
}
 |