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 (
|
2020-05-09 11:16:54 -04:00
|
|
|
"context"
|
|
|
|
|
2018-09-05 14:54:38 -04:00
|
|
|
"github.com/Microsoft/hcsshim/internal/hcserror"
|
|
|
|
"github.com/Microsoft/hcsshim/internal/interop"
|
2020-05-09 11:16:54 -04:00
|
|
|
"github.com/Microsoft/hcsshim/internal/oc"
|
|
|
|
"go.opencensus.io/trace"
|
2018-09-05 14:54:38 -04:00
|
|
|
)
|
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.
|
2020-05-09 11:16:54 -04:00
|
|
|
func GetSharedBaseImages(ctx context.Context) (_ string, err error) {
|
2019-02-28 13:16:30 -05:00
|
|
|
title := "hcsshim::GetSharedBaseImages"
|
2020-05-09 11:16:54 -04:00
|
|
|
ctx, span := trace.StartSpan(ctx, title)
|
|
|
|
defer span.End()
|
|
|
|
defer func() { oc.SetSpanStatus(span, err) }()
|
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
|
|
|
}
|
2020-05-09 11:16:54 -04:00
|
|
|
imageData := interop.ConvertAndFreeCoTaskMemString(buffer)
|
|
|
|
span.AddAttributes(trace.StringAttribute("imageData", imageData))
|
|
|
|
return imageData, nil
|
2018-03-19 18:57:30 -04:00
|
|
|
}
|