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