2015-05-27 13:15:14 -07:00
|
|
|
package hcsshim
|
|
|
|
|
2016-02-01 23:09:35 +00:00
|
|
|
import "github.com/Sirupsen/logrus"
|
2015-05-27 13:15:14 -07:00
|
|
|
|
2015-08-27 15:46:00 -07:00
|
|
|
// DestroyLayer will remove the on-disk files representing the layer with the given
|
|
|
|
// id, including that layer's containing folder, if any.
|
2015-05-27 13:15:14 -07:00
|
|
|
func DestroyLayer(info DriverInfo, id string) error {
|
|
|
|
title := "hcsshim::DestroyLayer "
|
2015-10-12 16:34:03 -07:00
|
|
|
logrus.Debugf(title+"Flavour %d ID %s", info.Flavour, id)
|
2015-05-27 13:15:14 -07:00
|
|
|
|
|
|
|
// Convert info to API calling convention
|
|
|
|
infop, err := convertDriverInfo(info)
|
|
|
|
if err != nil {
|
|
|
|
logrus.Error(err)
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2016-02-01 23:09:35 +00:00
|
|
|
err = destroyLayer(&infop, id)
|
|
|
|
if err != nil {
|
|
|
|
err = makeErrorf(err, title, "id=%s flavour=%d", id, info.Flavour)
|
2015-05-27 13:15:14 -07:00
|
|
|
logrus.Error(err)
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2015-10-12 16:34:03 -07:00
|
|
|
logrus.Debugf(title+"succeeded flavour=%d id=%s", info.Flavour, id)
|
2015-05-27 13:15:14 -07:00
|
|
|
return nil
|
|
|
|
}
|