From 9df601a1dfa5408d2964a96db150ea697703032a Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Thu, 12 Mar 2020 16:31:26 +0000 Subject: [PATCH] bin, vmm: Centralise the net syntax This will allow the syntax to be reused with cloud-hypervsor binary and ch-remote. Signed-off-by: Rob Bradford --- src/main.rs | 7 +------ vmm/src/config.rs | 5 +++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 1e7ab0faa..eed3cd7ed 100755 --- a/src/main.rs +++ b/src/main.rs @@ -131,12 +131,7 @@ fn create_app<'a, 'b>( .arg( Arg::with_name("net") .long("net") - .help( - "Network parameters \ - \"tap=,ip=,mask=,mac=,iommu=on|off,\ - num_queues=,queue_size=,\ - vhost_user=,socket=\"", - ) + .help(config::NetConfig::SYNTAX) .takes_value(true) .min_values(1) .group("vm-config"), diff --git a/vmm/src/config.rs b/vmm/src/config.rs index 7b838e2c0..0cc4ee30b 100644 --- a/vmm/src/config.rs +++ b/vmm/src/config.rs @@ -553,6 +553,11 @@ fn default_netconfig_queue_size() -> u16 { } impl NetConfig { + pub const SYNTAX: &'static str = "Network parameters \ + \"tap=,ip=,mask=,mac=,iommu=on|off,\ + num_queues=,queue_size=,\ + vhost_user=,socket=\""; + pub fn parse(net: &str) -> Result { // Split the parameters based on the comma delimiter let params_list: Vec<&str> = net.split(',').collect();