MCPcopy
hub / github.com/containerd/containerd / loadShimInfo

Method loadShimInfo

core/runtime/v2/shim_manager.go:481–512  ·  view source on GitHub ↗
(ctx context.Context, shim string)

Source from the content-addressed store, hash-verified

479}
480
481func (m *ShimManager) loadShimInfo(ctx context.Context, shim string) (*shimInfo, error) {
482 if i, ok := m.shimInfos.Load(shim); ok {
483 return i.(*shimInfo), nil
484 }
485 // Avoid fetching info for default shims with known behavior
486 if shim == "io.containerd.runc.v2" || shim == "io.containerd.runhcs.v1" {
487 sinfo := &shimInfo{}
488 m.shimInfos.Store(shim, sinfo)
489 return sinfo, nil
490 }
491
492 rinfo, err := getRuntimeInfo(ctx, m, &apitypes.RuntimeRequest{RuntimePath: shim})
493 if err != nil {
494 return nil, err
495 }
496 sinfo := &shimInfo{}
497
498 if rinfo.Annotations != nil {
499 if v, ok := rinfo.Annotations[allowedMounts]; ok {
500 sinfo.handledMounts = strings.Split(v, ",")
501 }
502 }
503
504 fields := log.Fields{}
505 for k, v := range rinfo.Annotations {
506 fields[k] = v
507 }
508 log.G(ctx).WithFields(fields).WithField("shim", shim).Debug("loaded shim info")
509
510 m.shimInfos.Store(shim, sinfo)
511 return sinfo, nil
512}

Callers 1

CreateMethod · 0.80

Calls 3

getRuntimeInfoFunction · 0.85
LoadMethod · 0.80
StoreMethod · 0.65

Tested by

no test coverage detected