Skip to content

Commit

Permalink
update: Add missing options to the update subcommand
Browse files Browse the repository at this point in the history
Add command-line options as documented in
https://github.com/opencontainers/runc/blob/main/man/runc-update.8.md

Signed-off-by: Christophe de Dinechin <[email protected]>
  • Loading branch information
c3d committed Mar 7, 2023
1 parent b71aa52 commit b3e2292
Showing 1 changed file with 55 additions and 3 deletions.
58 changes: 55 additions & 3 deletions crates/liboci-cli/src/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,67 @@ use std::path::PathBuf;
/// Update running container resource constraints
#[derive(Parser, Debug)]
pub struct Update {
#[clap(value_parser = clap::builder::NonEmptyStringValueParser::new(), required = true)]
pub container_id: String,

/// Read the new resource limits from the given json file. Use - to read from stdin.
/// If this option is used, all other options are ignored.
#[clap(short, long)]
pub resources: Option<PathBuf>,

/// Set a new I/O weight
#[clap(long)]
pub blkio_weight: Option<u64>,

/// Set CPU CFS period to be used for hardcapping (in microseconds)
#[clap(long)]
pub cpu_period: Option<u64>,

/// Set CPU usage limit within a given period (in microseconds)
#[clap(long)]
pub cpu_quota: Option<u64>,

/// Set CPU realtime period to be used for hardcapping (in microseconds)
#[clap(long)]
pub cpu_rt_period: Option<u64>,

/// Set CPU realtime hardcap limit (in microseconds)
#[clap(long)]
pub cpu_rt_runtime: Option<u64>,

/// Set CPU shares (relative weight vs. other containers)
#[clap(long)]
pub cpu_share: Option<u64>,

/// Set CPU(s) to use. The list can contain commas and ranges. For example: 0-3,7
#[clap(long)]
pub cpuset_cpus: Option<String>,

/// Set memory node(s) to use. The list format is the same as for --cpuset-cpus.
#[clap(long)]
pub cpuset_mems: Option<String>,

/// Set memory limit to num bytes.
#[clap(long)]
pub memory: Option<u64>,

/// Set memory reservation (or soft limit) to num bytes.
#[clap(long)]
pub memory_reservation: Option<u64>,

/// Set total memory + swap usage to num bytes. Use -1 to unset the limit (i.e. use unlimited swap).
#[clap(long)]
pub memory_swap: Option<i64>,

/// Set the maximum number of processes allowed in the container
#[clap(long)]
pub pids_limit: Option<i64>,

/// Set the value for Intel RDT/CAT L3 cache schema.
#[clap(long)]
pub l3_cache_schema: Option<String>,

/// Set the Intel RDT/MBA memory bandwidth schema.
#[clap(long)]
pub mem_bw_schema: Option<String>,

#[clap(value_parser = clap::builder::NonEmptyStringValueParser::new(), required = true)]
pub container_id: String,
}

0 comments on commit b3e2292

Please sign in to comment.