mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-08 19:33:07 +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)]
|
||||
#[serde(untagged, deny_unknown_fields)]
|
||||
pub enum NetParametersMode {
|
||||
TapName {
|
||||
tap_name: String,
|
||||
},
|
||||
TapFd {
|
||||
tap_fd: i32,
|
||||
},
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
TapName { tap_name: String },
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
TapFd { tap_fd: i32 },
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
RawConfig {
|
||||
#[serde(default)]
|
||||
vhost_net: bool,
|
||||
|
@ -837,7 +836,7 @@ mod tests {
|
|||
let params = from_net_arg("");
|
||||
assert!(params.is_err());
|
||||
|
||||
let params = from_net_arg("tap_name=tap").unwrap();
|
||||
let params = from_net_arg("tap-name=tap").unwrap();
|
||||
assert_eq!(
|
||||
params,
|
||||
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!(
|
||||
params,
|
||||
NetParameters {
|
||||
|
@ -856,7 +855,7 @@ mod tests {
|
|||
);
|
||||
|
||||
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();
|
||||
assert_eq!(
|
||||
|
@ -872,8 +871,8 @@ mod tests {
|
|||
);
|
||||
|
||||
let params = from_net_arg(
|
||||
"vhost_net=true,\
|
||||
host_ip=\"192.168.10.1\",\
|
||||
"vhost-net=true,\
|
||||
host-ip=\"192.168.10.1\",\
|
||||
netmask=\"255.255.255.0\",\
|
||||
mac=\"3d:70:eb:61:1a:91\"",
|
||||
)
|
||||
|
@ -892,18 +891,18 @@ mod tests {
|
|||
|
||||
// mixed configs
|
||||
assert!(from_net_arg(
|
||||
"tap_name=tap,\
|
||||
vhost_net=true,\
|
||||
host_ip=\"192.168.10.1\",\
|
||||
"tap-name=tap,\
|
||||
vhost-net=true,\
|
||||
host-ip=\"192.168.10.1\",\
|
||||
netmask=\"255.255.255.0\",\
|
||||
mac=\"3d:70:eb:61:1a:91\"",
|
||||
)
|
||||
.is_err());
|
||||
|
||||
// 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
|
||||
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
|
||||
/// up a vhost-user net device
|
||||
/// 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.
|
||||
/// tap_fd=INT - File descriptor for configured tap device.
|
||||
/// host_ip=STRING - IP address to assign to
|
||||
/// tap-fd=INT - File descriptor for configured tap device.
|
||||
/// host-ip=STRING - IP address to assign to
|
||||
/// host tap interface.
|
||||
/// netmask=STRING - Netmask for VM subnet.
|
||||
/// mac=STRING - MAC address for VM.
|
||||
|
|
Loading…
Reference in a new issue