2018-09-05 14:54:38 -04:00
|
|
|
package wclayer
|
2018-03-19 18:57:30 -04:00
|
|
|
|
2018-09-05 14:54:38 -04:00
|
|
|
import (
|
|
|
|
"github.com/Microsoft/hcsshim/internal/hcserror"
|
|
|
|
"github.com/Microsoft/hcsshim/internal/interop"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
|
|
)
|
2018-03-19 18:57:30 -04:00
|
|
|
|
|
|
|
// GetSharedBaseImages will enumerate the images stored in the common central
|
|
|
|
// image store and return descriptive info about those images for the purpose
|
|
|
|
// of registering them with the graphdriver, graph, and tagstore.
|
|
|
|
func GetSharedBaseImages() (imageData string, err error) {
|
2019-02-28 13:16:30 -05:00
|
|
|
title := "hcsshim::GetSharedBaseImages"
|
|
|
|
logrus.Debug(title)
|
|
|
|
defer func() {
|
|
|
|
if err != nil {
|
|
|
|
logrus.WithError(err).Error(err)
|
|
|
|
} else {
|
|
|
|
logrus.WithField("imageData", imageData).Debug(title + " - succeeded")
|
|
|
|
}
|
|
|
|
}()
|
2018-03-19 18:57:30 -04:00
|
|
|
|
|
|
|
var buffer *uint16
|
|
|
|
err = getBaseImages(&buffer)
|
|
|
|
if err != nil {
|
2019-02-28 13:16:30 -05:00
|
|
|
return "", hcserror.New(err, title+" - failed", "")
|
2018-03-19 18:57:30 -04:00
|
|
|
}
|
2019-02-28 13:16:30 -05:00
|
|
|
return interop.ConvertAndFreeCoTaskMemString(buffer), nil
|
2018-03-19 18:57:30 -04:00
|
|
|
}
|