liboci_cli/checkpoint.rs
1use std::path::PathBuf;
2
3use clap::Parser;
4
5/// Checkpoint a running container
6// Reference: https://github.com/opencontainers/runc/blob/main/man/runc-checkpoint.8.md
7// Unimplemented options vs runc: https://github.com/youki-dev/youki/issues/3394
8#[derive(Parser, Debug)]
9pub struct Checkpoint {
10 /// Path for saving criu image files
11 #[arg(long, default_value = "checkpoint")]
12 pub image_path: PathBuf,
13 /// Path for saving work files and logs
14 #[arg(long)]
15 pub work_path: Option<PathBuf>,
16 // TODO: Path for previous criu image file in pre-dump
17 // #[arg(long)]
18 // pub parent_path: Option<PathBuf>,
19 /// Leave the process running after checkpointing
20 #[arg(long)]
21 pub leave_running: bool,
22 /// Allow open tcp connections
23 #[arg(long)]
24 pub tcp_established: bool,
25 // TODO: Skip in-flight tcp connections
26 // #[arg(long)]
27 // pub tcp_skip_in_flight: bool,
28 /// Allow one to link unlinked files back when possible
29 #[arg(long)]
30 pub link_remap: bool,
31 /// Allow external unix sockets
32 #[arg(long)]
33 pub ext_unix_sk: bool,
34 /// Allow shell jobs
35 #[arg(long)]
36 pub shell_job: bool,
37 // TODO: Use lazy migration mechanism
38 // #[arg(long)]
39 // pub lazy_pages: bool,
40 // TODO: Pass a file descriptor fd to criu. Is u32 the right type?
41 // #[arg(long)]
42 // pub status_fd: Option<u32>,
43 // TODO: Start a page server at the given URL
44 // #[arg(long)]
45 // pub page_server: Option<String>,
46 /// Allow file locks
47 #[arg(long)]
48 pub file_locks: bool,
49 // TODO: Do a pre-dump
50 // #[arg(long)]
51 // pub pre_dump: bool,
52 #[arg(long, default_value = "soft", value_parser = clap::builder::PossibleValuesParser::new(["ignore", "full", "strict", "soft"]))]
53 pub manage_cgroups_mode: String,
54 // TODO: Checkpoint a namespace, but don't save its properties
55 // #[arg(long)]
56 // pub empty_ns: bool,
57 // TODO: Enable auto-deduplication
58 // #[arg(long)]
59 // pub auto_dedup: bool,
60 #[arg(value_parser = clap::builder::NonEmptyStringValueParser::new(), required = true)]
61 pub container_id: String,
62}