getsharedbaseimages.go 851 B

123456789101112131415161718192021222324252627282930
  1. package wclayer
  2. import (
  3. "github.com/Microsoft/hcsshim/internal/hcserror"
  4. "github.com/Microsoft/hcsshim/internal/interop"
  5. "github.com/sirupsen/logrus"
  6. )
  7. // GetSharedBaseImages will enumerate the images stored in the common central
  8. // image store and return descriptive info about those images for the purpose
  9. // of registering them with the graphdriver, graph, and tagstore.
  10. func GetSharedBaseImages() (imageData string, err error) {
  11. title := "hcsshim::GetSharedBaseImages"
  12. logrus.Debug(title)
  13. defer func() {
  14. if err != nil {
  15. logrus.WithError(err).Error(err)
  16. } else {
  17. logrus.WithField("imageData", imageData).Debug(title + " - succeeded")
  18. }
  19. }()
  20. var buffer *uint16
  21. err = getBaseImages(&buffer)
  22. if err != nil {
  23. return "", hcserror.New(err, title+" - failed", "")
  24. }
  25. return interop.ConvertAndFreeCoTaskMemString(buffer), nil
  26. }