mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Add support for letting the VMM create the TAP interface
Until now, the only way to get some networking with cloud-hypervisor was to let the user create a TAP interface first, and then to provide the name of this interface to the VMM. This patch extend the previous behavior by adding the support for the creation of a brand new TAP interface from the VMM itself. In case no interface name is provided through "tap=<if_name>", we will assume the user wants the VMM to create and set the interface on its behalf, no matter the value of other parameters (ip, mask, and mac). In this same scenario, because the user expects the VMM to create the TAP interface, he can also provide the associated IP address and subnet mask associated with it. In case those values are not provided, some default ones will be picked. No matter the value of "tap", the MAC address will always be set, and if no value is provided, the VMM will come up with a default value for it. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
committed by
Samuel Ortiz
parent
0c4c330843
commit
5934f30fde
10
src/main.rs
10
src/main.rs
@@ -40,7 +40,7 @@ fn main() {
|
||||
.arg(
|
||||
Arg::with_name("net")
|
||||
.long("net")
|
||||
.help("Network parameters \"tap=<if_name>,mac=<mac_addr>\"")
|
||||
.help("Network parameters \"tap=<if_name>,ip=<ip_addr>,mask=<net_mask>,mac=<mac_addr>\"")
|
||||
.takes_value(true),
|
||||
)
|
||||
.arg(
|
||||
@@ -81,8 +81,12 @@ fn main() {
|
||||
let disk_path = disk_arg.as_path();
|
||||
|
||||
let mut net_params = None;
|
||||
if let Some(net) = cmd_arguments.value_of("net") {
|
||||
net_params = Some(net.to_string());
|
||||
if cmd_arguments.is_present("net") {
|
||||
if let Some(net) = cmd_arguments.value_of("net") {
|
||||
net_params = Some(net.to_string());
|
||||
} else {
|
||||
net_params = Some(String::new())
|
||||
}
|
||||
}
|
||||
|
||||
let rng_path = match cmd_arguments.occurrences_of("rng") {
|
||||
|
||||
Reference in New Issue
Block a user