1package wclayer 2 3import ( 4 "github.com/Microsoft/hcsshim/internal/hcserror" 5 "github.com/sirupsen/logrus" 6) 7 8// CreateScratchLayer creates and populates new read-write layer for use by a container. 9// This requires both the id of the direct parent layer, as well as the full list 10// of paths to all parent layers up to the base (and including the direct parent 11// whose id was provided). 12func CreateScratchLayer(path string, parentLayerPaths []string) error { 13 title := "hcsshim::CreateScratchLayer " 14 logrus.Debugf(title+"path %s", path) 15 16 // Generate layer descriptors 17 layers, err := layerPathsToDescriptors(parentLayerPaths) 18 if err != nil { 19 return err 20 } 21 22 err = createSandboxLayer(&stdDriverInfo, path, 0, layers) 23 if err != nil { 24 err = hcserror.Errorf(err, title, "path=%s", path) 25 logrus.Error(err) 26 return err 27 } 28 29 logrus.Debugf(title+"- succeeded path=%s", path) 30 return nil 31} 32