vmm: config: Move --vsock syntax to VsockConfig

This means it can be reused with ch-remote.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2020-04-28 15:56:28 +01:00
parent 6e049e0da1
commit f8501a3bd3
2 changed files with 3 additions and 4 deletions

View File

@ -195,10 +195,7 @@ fn create_app<'a, 'b>(
.arg(
Arg::with_name("vsock")
.long("vsock")
.help(
"Virtio VSOCK parameters \
\"cid=<context_id>,sock=<socket_path>,iommu=on|off,id=<device_id>\"",
)
.help(config::VsockConfig::SYNTAX)
.takes_value(true)
.number_of_values(1)
.group("vm-config"),

View File

@ -1141,6 +1141,8 @@ pub struct VsockConfig {
}
impl VsockConfig {
pub const SYNTAX: &'static str = "Virtio VSOCK parameters \
\"cid=<context_id>,sock=<socket_path>,iommu=on|off,id=<device_id>\"";
pub fn parse(vsock: &str) -> Result<Self> {
let mut parser = OptionParser::new();
parser.add("sock").add("cid").add("iommu").add("id");