This commit is contained in:
2025-07-23 18:41:30 +08:00
parent a9add11578
commit 730a7fb8c0
12 changed files with 57 additions and 3 deletions

View File

@@ -138,6 +138,7 @@ func (b *binary) Start(ctx context.Context, opts *types.Any, onClose func()) (_
if err != nil {
return nil, err
}
log.G(ctx).Infof("mzq-test, binary.go Start, ns: %v, cmd: %+v, response: %v, opts: %+v, conn: %+v, params: %v\n", ns, cmd, string(response), opts, conn, params)
// Save bootstrap configuration (so containerd can restore shims after restart).
if err := writeBootstrapParams(filepath.Join(b.bundle.Path, "bootstrap.json"), params); err != nil {

View File

@@ -111,6 +111,13 @@ func loadShim(ctx context.Context, bundle *Bundle, onClose func()) (_ ShimInstan
if err != nil {
return nil, fmt.Errorf("unable to make connection: %w", err)
}
a := log.Fields{
"mzq-test": true,
"conn": fmt.Sprintf("%+v", conn),
"params": fmt.Sprintf("%+v", params),
"bundle": fmt.Sprintf("%+v", bundle),
}
log.G(ctx).WithFields(a).Info("shim.go loadShim")
defer func() {
if retErr != nil {
@@ -277,6 +284,12 @@ func makeConnection(ctx context.Context, id string, params client.BootstrapParam
}
}()
a := log.Fields{
"mzq-test": true,
"conn": fmt.Sprintf("%+v", conn),
"params": fmt.Sprintf("%+v", params),
}
log.G(ctx).WithFields(a).Info("shim.go makeConnection makeConnection")
return ttrpc.NewClient(
conn,
ttrpc.WithOnClose(onClose),

View File

@@ -207,6 +207,14 @@ func (m *ShimManager) Start(ctx context.Context, id string, bundle *Bundle, opts
if err != nil {
return nil, fmt.Errorf("failed to load sandbox task %q: %w", opts.SandboxID, err)
}
a := log.Fields{
"mzq-test": true,
"id": id,
"opts": fmt.Sprintf("%+v", opts),
"params": fmt.Sprintf("%+v", params),
"bundle": fmt.Sprintf("%+v", bundle),
}
log.G(ctx).WithFields(a).Info("manager.go Start")
if err := m.shims.Add(ctx, shim); err != nil {
return nil, err
@@ -256,7 +264,13 @@ func (m *ShimManager) startShim(ctx context.Context, bundle *Bundle, id string,
env: m.env,
})
shim, err := b.Start(ctx, typeurl.MarshalProto(topts), func() {
log.G(ctx).WithField("id", id).Info("shim disconnected")
a := log.Fields{
"mzq-test": true,
"ns": ns,
"topts": topts,
"b": fmt.Sprintf("%+v", b),
}
log.G(ctx).WithFields(a).Info("shim disconnected")
cleanupAfterDeadShim(cleanup.Background(ctx), id, m.shims, m.events, b)
// Remove self from the runtime task list. Even though the cleanupAfterDeadShim()