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
use clap::Parser;
use std::path::PathBuf;
/// Checkpoint a running container
/// Reference: https://github.com/opencontainers/runc/blob/main/man/runc-checkpoint.8.md
#[derive(Parser, Debug)]
pub struct Checkpoint {
/// Path for saving criu image files
#[clap(long, default_value = "checkpoint")]
pub image_path: PathBuf,
/// Path for saving work files and logs
#[clap(long)]
pub work_path: Option<PathBuf>,
/// Path for previous criu image file in pre-dump
#[clap(long)]
pub parent_path: Option<PathBuf>,
/// Leave the process running after checkpointing
#[clap(long)]
pub leave_running: bool,
/// Allow open tcp connections
#[clap(long)]
pub tcp_established: bool,
/// Allow external unix sockets
#[clap(long)]
pub ext_unix_sk: bool,
/// Allow shell jobs
#[clap(long)]
pub shell_job: bool,
/// Use lazy migration mechanism
#[clap(long)]
pub lazy_pages: bool,
/// Pass a file descriptor fd to criu
#[clap(long)]
pub status_fd: Option<u32>, // TODO: Is u32 the right type?
/// Start a page server at the given URL
#[clap(long)]
pub page_server: Option<String>,
/// Allow file locks
#[clap(long)]
pub file_locks: bool,
/// Do a pre-dump
#[clap(long)]
pub pre_dump: bool,
/// Cgroups mode
#[clap(long)]
pub manage_cgroups_mode: Option<String>,
/// Checkpoint a namespace, but don't save its properties
#[clap(long)]
pub empty_ns: bool,
/// Enable auto-deduplication
#[clap(long)]
pub auto_dedup: bool,
#[clap(value_parser = clap::builder::NonEmptyStringValueParser::new(), required = true)]
pub container_id: String,
}