Unverified Commit b07be71b authored by Janelle Cai's avatar Janelle Cai Committed by GitHub
Browse files

fix(chrek): pass checkpointPath to restore (#6941)

parent d71c0c32
...@@ -83,7 +83,7 @@ func ExecuteRestore( ...@@ -83,7 +83,7 @@ func ExecuteRestore(
// BuildRestoreOpts assembles CriuOpts for a CRIU restore from the checkpoint manifest. // BuildRestoreOpts assembles CriuOpts for a CRIU restore from the checkpoint manifest.
// ImagesDirFd and WorkDirFd are left unset — ExecuteRestore opens them at restore time. // ImagesDirFd and WorkDirFd are left unset — ExecuteRestore opens them at restore time.
func BuildRestoreOpts(m *types.CheckpointManifest, cgroupRoot string, log logr.Logger) (*criurpc.CriuOpts, error) { func BuildRestoreOpts(m *types.CheckpointManifest, checkpointPath string, cgroupRoot string, log logr.Logger) (*criurpc.CriuOpts, error) {
extMounts, err := buildRestoreExtMounts(m) extMounts, err := buildRestoreExtMounts(m)
if err != nil { if err != nil {
return nil, err return nil, err
...@@ -112,7 +112,7 @@ func BuildRestoreOpts(m *types.CheckpointManifest, cgroupRoot string, log logr.L ...@@ -112,7 +112,7 @@ func BuildRestoreOpts(m *types.CheckpointManifest, cgroupRoot string, log logr.L
} }
} }
criuConfPath := filepath.Join(settings.WorkDir, "..", criuConfFilename) criuConfPath := filepath.Join(checkpointPath, criuConfFilename)
if _, err := os.Stat(criuConfPath); err == nil { if _, err := os.Stat(criuConfPath); err == nil {
criuOpts.ConfigFile = proto.String(criuConfPath) criuOpts.ConfigFile = proto.String(criuConfPath)
} }
......
...@@ -42,7 +42,7 @@ func RestoreInNamespace(ctx context.Context, opts RestoreOptions, log logr.Logge ...@@ -42,7 +42,7 @@ func RestoreInNamespace(ctx context.Context, opts RestoreOptions, log logr.Logge
"checkpoint_has_cuda", !m.CUDA.IsEmpty(), "checkpoint_has_cuda", !m.CUDA.IsEmpty(),
) )
// Phase 1: Configure — build CRIU opts from manifest // Phase 1: Configure — build CRIU opts from manifest
criuOpts, err := criu.BuildRestoreOpts(m, opts.CgroupRoot, log) criuOpts, err := criu.BuildRestoreOpts(m, opts.CheckpointPath, opts.CgroupRoot, log)
if err != nil { if err != nil {
return 0, err return 0, err
} }
...@@ -57,7 +57,6 @@ func RestoreInNamespace(ctx context.Context, opts RestoreOptions, log logr.Logge ...@@ -57,7 +57,6 @@ func RestoreInNamespace(ctx context.Context, opts RestoreOptions, log logr.Logge
return restoredPID, nil return restoredPID, nil
} }
func executeRestore(ctx context.Context, criuOpts *criurpc.CriuOpts, m *types.CheckpointManifest, opts RestoreOptions, log logr.Logger) (int, error) { func executeRestore(ctx context.Context, criuOpts *criurpc.CriuOpts, m *types.CheckpointManifest, opts RestoreOptions, log logr.Logger) (int, error) {
// Apply rootfs diff inside the namespace (target root is /) // Apply rootfs diff inside the namespace (target root is /)
if err := common.ApplyRootfsDiff(opts.CheckpointPath, "/", log); err != nil { if err := common.ApplyRootfsDiff(opts.CheckpointPath, "/", log); err != nil {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment