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