createsandboxlayer.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package hcsshim
  2. import "github.com/Sirupsen/logrus"
  3. // CreateSandboxLayer creates and populates new read-write layer for use by a container.
  4. // This requires both the id of the direct parent layer, as well as the full list
  5. // of paths to all parent layers up to the base (and including the direct parent
  6. // whose id was provided).
  7. func CreateSandboxLayer(info DriverInfo, layerId, parentId string, parentLayerPaths []string) error {
  8. title := "hcsshim::CreateSandboxLayer "
  9. logrus.Debugf(title+"layerId %s parentId %s", layerId, parentId)
  10. // Generate layer descriptors
  11. layers, err := layerPathsToDescriptors(parentLayerPaths)
  12. if err != nil {
  13. return err
  14. }
  15. // Convert info to API calling convention
  16. infop, err := convertDriverInfo(info)
  17. if err != nil {
  18. logrus.Error(err)
  19. return err
  20. }
  21. err = createSandboxLayer(&infop, layerId, parentId, layers)
  22. if err != nil {
  23. err = makeErrorf(err, title, "layerId=%s parentId=%s", layerId, parentId)
  24. logrus.Error(err)
  25. return err
  26. }
  27. logrus.Debugf(title+"- succeeded layerId=%s parentId=%s", layerId, parentId)
  28. return nil
  29. }