mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
rust/pvapconfig: Introduce new tool pvapconfig
pvapconfig is a new tool for automatically configuring the APQNs within an Secure Execution KVM guest with AP pass-through support. Based on a given AP configuration it tries to find a matching APQN and bind and associate it with the correct secret. Signed-off-by: Harald Freudenberger <freude@linux.ibm.com> Reviewed-by: Ingo Franzki <ifranzki@linux.ibm.com> Reviewed-by: Holger Dengler <dengler@linux.ibm.com> Reviewed-by: Steffen Eiden <seiden@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
0764460eaf
commit
94a38ebc3a
@@ -0,0 +1,63 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
// Copyright IBM Corp. 2023
|
||||
//
|
||||
//! Command line interface for pvapconfig
|
||||
//
|
||||
|
||||
use clap::Parser;
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
/// The default pvapconfig config file
|
||||
pub const PATH_DEFAULT_CONFIG_FILE: &str = "/etc/pvapconfig.yaml";
|
||||
|
||||
#[derive(Parser, Clone)]
|
||||
pub struct Cli {
|
||||
/// Provide a custom config file (overwrites default /etc/pvapconfig.yaml).
|
||||
#[arg(short, long, value_name = "FILE")]
|
||||
pub config: Option<String>,
|
||||
|
||||
/// Dry run: display the actions but don't actually perform them on the APQNs.
|
||||
#[arg(short = 'n', long = "dry-run")]
|
||||
pub dryrun: bool,
|
||||
|
||||
/// Enforce strict match: All config entries need to be fullfilled.
|
||||
///
|
||||
/// By default it is enough to successfully apply at least one config entry.
|
||||
/// With the strict flag enabled, all config entries within a config file
|
||||
/// need to be applied successful.
|
||||
#[arg(long = "strict")]
|
||||
pub strict: bool,
|
||||
|
||||
/// Provide more detailed output.
|
||||
#[arg(short, long)]
|
||||
pub verbose: bool,
|
||||
|
||||
/// Print version information and exit.
|
||||
#[arg(short = 'V', long)]
|
||||
pub version: bool,
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
pub static ref ARGS: Cli = Cli::parse();
|
||||
}
|
||||
|
||||
impl Cli {
|
||||
/// verbose returns true if the verbose command line option
|
||||
/// was given, otherwise false is returned.
|
||||
pub fn verbose(&self) -> bool {
|
||||
self.verbose
|
||||
}
|
||||
|
||||
/// dryrun returns true if the dry-run command line option
|
||||
/// was given, otherwise false is returned.
|
||||
pub fn dryrun(&self) -> bool {
|
||||
self.dryrun
|
||||
}
|
||||
|
||||
/// strict returns true if the strict flag was given, otherwise
|
||||
/// false is returned.
|
||||
pub fn strict(&self) -> bool {
|
||||
self.strict
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user