(ctx context.Context, shim string)
| 479 | } |
| 480 | |
| 481 | func (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 | } |
no test coverage detected