k3s/vendor/github.com/Microsoft/hcsshim/internal/wclayer/getsharedbaseimages.go

30 lines
928 B
Go
Raw Normal View History

2019-01-12 04:58:27 +00:00
package wclayer
import (
2020-08-10 17:43:49 +00:00
"context"
2019-01-12 04:58:27 +00:00
"github.com/Microsoft/hcsshim/internal/hcserror"
"github.com/Microsoft/hcsshim/internal/interop"
2020-08-10 17:43:49 +00:00
"github.com/Microsoft/hcsshim/internal/oc"
"go.opencensus.io/trace"
2019-01-12 04:58:27 +00: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.
2020-08-10 17:43:49 +00:00
func GetSharedBaseImages(ctx context.Context) (_ string, err error) {
2019-07-10 00:29:38 +00:00
title := "hcsshim::GetSharedBaseImages"
2020-08-10 17:43:49 +00:00
ctx, span := trace.StartSpan(ctx, title)
defer span.End()
defer func() { oc.SetSpanStatus(span, err) }()
2019-01-12 04:58:27 +00:00
var buffer *uint16
err = getBaseImages(&buffer)
if err != nil {
2019-07-10 00:29:38 +00:00
return "", hcserror.New(err, title+" - failed", "")
2019-01-12 04:58:27 +00:00
}
2020-08-10 17:43:49 +00:00
imageData := interop.ConvertAndFreeCoTaskMemString(buffer)
span.AddAttributes(trace.StringAttribute("imageData", imageData))
return imageData, nil
2019-01-12 04:58:27 +00:00
}