bin, vmm: Centralise the pmem syntax

This will allow the syntax to be reused with cloud-hypervisor binary and
ch-remote.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2020-03-12 16:31:26 +00:00 committed by Sebastien Boeuf
parent 61e34331c2
commit a7296bbb52
2 changed files with 4 additions and 5 deletions

View File

@ -165,11 +165,7 @@ fn create_app<'a, 'b>(
.arg(
Arg::with_name("pmem")
.long("pmem")
.help(
"Persistent memory parameters \
\"file=<backing_file_path>,size=<persistent_memory_size>,iommu=on|off,\
mergeable=on|off,discard_writes=on|off,\"",
)
.help(config::PmemConfig::SYNTAX)
.takes_value(true)
.min_values(1)
.group("vm-config"),

View File

@ -776,6 +776,9 @@ pub struct PmemConfig {
}
impl PmemConfig {
pub const SYNTAX: &'static str = "Persistent memory parameters \
\"file=<backing_file_path>,size=<persistent_memory_size>,iommu=on|off,\
mergeable=on|off,discard_writes=on|off,\"";
pub fn parse(pmem: &str) -> Result<Self> {
// Split the parameters based on the comma delimiter
let params_list: Vec<&str> = pmem.split(',').collect();