2015-05-27 16:15:14 -04:00
|
|
|
package hcsshim
|
|
|
|
|
2016-02-01 18:09:35 -05:00
|
|
|
import "github.com/Sirupsen/logrus"
|
2015-05-27 16:15:14 -04:00
|
|
|
|
2015-08-27 18:46:00 -04:00
|
|
|
// CreateLayer creates a new, empty, read-only layer on the filesystem based on
|
|
|
|
// the parent layer provided.
|
2015-05-27 16:15:14 -04:00
|
|
|
func CreateLayer(info DriverInfo, id, parent string) error {
|
|
|
|
title := "hcsshim::CreateLayer "
|
2015-10-12 19:34:03 -04:00
|
|
|
logrus.Debugf(title+"Flavour %d ID %s parent %s", info.Flavour, id, parent)
|
2015-05-27 16:15:14 -04:00
|
|
|
|
|
|
|
// Convert info to API calling convention
|
|
|
|
infop, err := convertDriverInfo(info)
|
|
|
|
if err != nil {
|
|
|
|
logrus.Error(err)
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2016-02-01 18:09:35 -05:00
|
|
|
err = createLayer(&infop, id, parent)
|
|
|
|
if err != nil {
|
|
|
|
err = makeErrorf(err, title, "id=%s parent=%s flavour=%d", id, parent, info.Flavour)
|
2015-05-27 16:15:14 -04:00
|
|
|
logrus.Error(err)
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
logrus.Debugf(title+" - succeeded id=%s parent=%s flavour=%d", id, parent, info.Flavour)
|
|
|
|
return nil
|
|
|
|
}
|