Skip to main content

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    #[clap(long, default_value = "checkpoint")]
12    pub image_path: PathBuf,
13    /// Path for saving work files and logs
14    #[clap(long)]
15    pub work_path: Option<PathBuf>,
16    /// TODO: Path for previous criu image file in pre-dump
17    /// #[clap(long)]
18    /// pub parent_path: Option<PathBuf>,
19    /// Leave the process running after checkpointing
20    #[clap(long)]
21    pub leave_running: bool,
22    /// Allow open tcp connections
23    #[clap(long)]
24    pub tcp_established: bool,
25    /// TODO: Skip in-flight tcp connections
26    /// #[clap(long)]
27    /// pub tcp_skip_in_flight: bool,
28    /// TODO: Allow one to link unlinked files back when possible
29    /// #[clap(long)]
30    /// pub link_remap: bool,
31    /// Allow external unix sockets
32    #[clap(long)]
33    pub ext_unix_sk: bool,
34    /// Allow shell jobs
35    #[clap(long)]
36    pub shell_job: bool,
37    /// TODO: Use lazy migration mechanism
38    /// #[clap(long)]
39    /// pub lazy_pages: bool,
40    /// TODO: Pass a file descriptor fd to criu. Is u32 the right type?
41    /// #[clap(long)]
42    /// pub status_fd: Option<u32>,
43    /// TODO: Start a page server at the given URL
44    /// #[clap(long)]
45    /// pub page_server: Option<String>,
46    /// Allow file locks
47    #[clap(long)]
48    pub file_locks: bool,
49    /// TODO: Do a pre-dump
50    /// #[clap(long)]
51    /// pub pre_dump: bool,
52    /// TODO: Cgroups mode
53    /// #[clap(long)]
54    /// pub manage_cgroups_mode: Option<String>,
55    /// TODO: Checkpoint a namespace, but don't save its properties
56    /// #[clap(long)]
57    /// pub empty_ns: bool,
58    /// TODO: Enable auto-deduplication
59    /// #[clap(long)]
60    /// pub auto_dedup: bool,
61
62    #[clap(value_parser = clap::builder::NonEmptyStringValueParser::new(), required = true)]
63    pub container_id: String,
64}