vmm: Add new flag "--vsock"

The new flag vsock is meant to be used in order to create a VM with a
virtio-vsock device attached to it. Two parameters are needed with this
device, "cid" representing the guest context ID, and "sock" representing
the UNIX socket path which can be accessed from the host.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2019-09-04 10:39:17 -07:00
parent c48ca61417
commit 11e7ece9f5
2 changed files with 60 additions and 0 deletions

View File

@@ -165,6 +165,16 @@ fn main() {
.takes_value(true)
.min_values(1),
)
.arg(
Arg::with_name("vsock")
.long("vsock")
.help(
"Virtio VSOCK parameters \"cid=<context_id>,\
sock=<socket_path>\"",
)
.takes_value(true)
.min_values(1),
)
.arg(
Arg::with_name("v")
.short("v")
@@ -200,6 +210,7 @@ fn main() {
let vhost_user_net: Option<Vec<&str>> = cmd_arguments
.values_of("vhost-user-net")
.map(|x| x.collect());
let vsock: Option<Vec<&str>> = cmd_arguments.values_of("vsock").map(|x| x.collect());
let log_level = match cmd_arguments.occurrences_of("v") {
0 => LevelFilter::Error,
@@ -239,6 +250,7 @@ fn main() {
console,
devices,
vhost_user_net,
vsock,
}) {
Ok(config) => config,
Err(e) => {