mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-09 03:57:24 +00:00
crosvm: rename all "net" parameters to use kebab-case
This option has just been introduced and has no user, so we can slip this one under the rug. BUG=b:255223604 TEST=cargo test -p devices net::tests TEST=`cargo run -- .. --net tap-name=crosvm_tap` properly creates a TAP network device. Change-Id: I228e5f2539c49314399cf254ddaf795bd0265a2f Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3990100 Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org> Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org> Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
This commit is contained in:
parent
dc5a6fe9bd
commit
10c819fb36
2 changed files with 18 additions and 19 deletions
|
@ -142,12 +142,11 @@ pub enum NetError {
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Debug)]
|
#[derive(Serialize, Deserialize, PartialEq, Debug)]
|
||||||
#[serde(untagged, deny_unknown_fields)]
|
#[serde(untagged, deny_unknown_fields)]
|
||||||
pub enum NetParametersMode {
|
pub enum NetParametersMode {
|
||||||
TapName {
|
#[serde(rename_all = "kebab-case")]
|
||||||
tap_name: String,
|
TapName { tap_name: String },
|
||||||
},
|
#[serde(rename_all = "kebab-case")]
|
||||||
TapFd {
|
TapFd { tap_fd: i32 },
|
||||||
tap_fd: i32,
|
#[serde(rename_all = "kebab-case")]
|
||||||
},
|
|
||||||
RawConfig {
|
RawConfig {
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
vhost_net: bool,
|
vhost_net: bool,
|
||||||
|
@ -837,7 +836,7 @@ mod tests {
|
||||||
let params = from_net_arg("");
|
let params = from_net_arg("");
|
||||||
assert!(params.is_err());
|
assert!(params.is_err());
|
||||||
|
|
||||||
let params = from_net_arg("tap_name=tap").unwrap();
|
let params = from_net_arg("tap-name=tap").unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
params,
|
params,
|
||||||
NetParameters {
|
NetParameters {
|
||||||
|
@ -847,7 +846,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
let params = from_net_arg("tap_fd=12").unwrap();
|
let params = from_net_arg("tap-fd=12").unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
params,
|
params,
|
||||||
NetParameters {
|
NetParameters {
|
||||||
|
@ -856,7 +855,7 @@ mod tests {
|
||||||
);
|
);
|
||||||
|
|
||||||
let params = from_net_arg(
|
let params = from_net_arg(
|
||||||
"host_ip=\"192.168.10.1\",netmask=\"255.255.255.0\",mac=\"3d:70:eb:61:1a:91\"",
|
"host-ip=\"192.168.10.1\",netmask=\"255.255.255.0\",mac=\"3d:70:eb:61:1a:91\"",
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -872,8 +871,8 @@ mod tests {
|
||||||
);
|
);
|
||||||
|
|
||||||
let params = from_net_arg(
|
let params = from_net_arg(
|
||||||
"vhost_net=true,\
|
"vhost-net=true,\
|
||||||
host_ip=\"192.168.10.1\",\
|
host-ip=\"192.168.10.1\",\
|
||||||
netmask=\"255.255.255.0\",\
|
netmask=\"255.255.255.0\",\
|
||||||
mac=\"3d:70:eb:61:1a:91\"",
|
mac=\"3d:70:eb:61:1a:91\"",
|
||||||
)
|
)
|
||||||
|
@ -892,18 +891,18 @@ mod tests {
|
||||||
|
|
||||||
// mixed configs
|
// mixed configs
|
||||||
assert!(from_net_arg(
|
assert!(from_net_arg(
|
||||||
"tap_name=tap,\
|
"tap-name=tap,\
|
||||||
vhost_net=true,\
|
vhost-net=true,\
|
||||||
host_ip=\"192.168.10.1\",\
|
host-ip=\"192.168.10.1\",\
|
||||||
netmask=\"255.255.255.0\",\
|
netmask=\"255.255.255.0\",\
|
||||||
mac=\"3d:70:eb:61:1a:91\"",
|
mac=\"3d:70:eb:61:1a:91\"",
|
||||||
)
|
)
|
||||||
.is_err());
|
.is_err());
|
||||||
|
|
||||||
// missing netmask
|
// missing netmask
|
||||||
assert!(from_net_arg("host_ip=\"192.168.10.1\",mac=\"3d:70:eb:61:1a:91\"").is_err());
|
assert!(from_net_arg("host-ip=\"192.168.10.1\",mac=\"3d:70:eb:61:1a:91\"").is_err());
|
||||||
|
|
||||||
// invalid parameter
|
// invalid parameter
|
||||||
assert!(from_net_arg("tap_name=tap,foomatic=true").is_err());
|
assert!(from_net_arg("tap-name=tap,foomatic=true").is_err());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1017,10 +1017,10 @@ pub struct RunCommand {
|
||||||
/// comma separated key=value pairs for setting
|
/// comma separated key=value pairs for setting
|
||||||
/// up a vhost-user net device
|
/// up a vhost-user net device
|
||||||
/// Possible key values:
|
/// Possible key values:
|
||||||
/// tap_name=STRING - name of a configured persistent TAP
|
/// tap-name=STRING - name of a configured persistent TAP
|
||||||
/// interface to use for networking.
|
/// interface to use for networking.
|
||||||
/// tap_fd=INT - File descriptor for configured tap device.
|
/// tap-fd=INT - File descriptor for configured tap device.
|
||||||
/// host_ip=STRING - IP address to assign to
|
/// host-ip=STRING - IP address to assign to
|
||||||
/// host tap interface.
|
/// host tap interface.
|
||||||
/// netmask=STRING - Netmask for VM subnet.
|
/// netmask=STRING - Netmask for VM subnet.
|
||||||
/// mac=STRING - MAC address for VM.
|
/// mac=STRING - MAC address for VM.
|
||||||
|
|
Loading…
Reference in a new issue