From f2d08bc00f0b4ca3fdb88bb2761d761c3488ce3d Mon Sep 17 00:00:00 2001 From: Xuewei Niu Date: Mon, 25 Dec 2023 21:04:33 +0800 Subject: [PATCH] runtime-rs: Remove unused index from Endpoints The affected `Endpoint`s are `VhostUserEndpoint` and `TapEndpoint`. Signed-off-by: Xuewei Niu --- src/runtime-rs/crates/resource/src/network/dan.rs | 2 -- .../crates/resource/src/network/endpoint/tap_endpoint.rs | 5 ----- .../resource/src/network/endpoint/vhost_user_endpoint.rs | 5 ----- 3 files changed, 12 deletions(-) diff --git a/src/runtime-rs/crates/resource/src/network/dan.rs b/src/runtime-rs/crates/resource/src/network/dan.rs index 0a0183b180..6fe50b3373 100644 --- a/src/runtime-rs/crates/resource/src/network/dan.rs +++ b/src/runtime-rs/crates/resource/src/network/dan.rs @@ -87,7 +87,6 @@ impl DanInner { } => Arc::new( VhostUserEndpoint::new( dev_mgr, - idx as u32, &name, &device.guest_mac, path, @@ -104,7 +103,6 @@ impl DanInner { } => Arc::new( TapEndpoint::new( &handle, - idx as u32, &name, tap_name, &device.guest_mac, diff --git a/src/runtime-rs/crates/resource/src/network/endpoint/tap_endpoint.rs b/src/runtime-rs/crates/resource/src/network/endpoint/tap_endpoint.rs index e22a91d922..490eca204f 100644 --- a/src/runtime-rs/crates/resource/src/network/endpoint/tap_endpoint.rs +++ b/src/runtime-rs/crates/resource/src/network/endpoint/tap_endpoint.rs @@ -21,9 +21,6 @@ use crate::network::{utils, EndpointState}; /// TapEndpoint is used to attach to the hypervisor directly #[derive(Debug)] pub struct TapEndpoint { - // Index - #[allow(dead_code)] - index: u32, // Name of virt interface name: String, // Hardware address of virt interface @@ -42,7 +39,6 @@ impl TapEndpoint { #[allow(clippy::too_many_arguments)] pub async fn new( handle: &rtnetlink::Handle, - index: u32, name: &str, tap_name: &str, guest_mac: &str, @@ -57,7 +53,6 @@ impl TapEndpoint { utils::get_mac_addr(&tap_link.attrs().hardware_addr).context("Get mac addr of tap")?; Ok(TapEndpoint { - index, name: name.to_owned(), guest_mac: guest_mac.to_owned(), tap_iface: NetworkInterface { diff --git a/src/runtime-rs/crates/resource/src/network/endpoint/vhost_user_endpoint.rs b/src/runtime-rs/crates/resource/src/network/endpoint/vhost_user_endpoint.rs index 380fefd810..480ce6b383 100644 --- a/src/runtime-rs/crates/resource/src/network/endpoint/vhost_user_endpoint.rs +++ b/src/runtime-rs/crates/resource/src/network/endpoint/vhost_user_endpoint.rs @@ -18,9 +18,6 @@ use crate::network::EndpointState; /// VhostUserEndpoint uses vhost-user-net device, which supports DPDK, etc. #[derive(Debug)] pub struct VhostUserEndpoint { - // Endpoint index - #[allow(dead_code)] - index: u32, // Name of virt interface name: String, // Hardware address of virt interface @@ -38,7 +35,6 @@ pub struct VhostUserEndpoint { impl VhostUserEndpoint { pub async fn new( dev_mgr: &Arc>, - index: u32, name: &str, guest_mac: &str, socket_path: &str, @@ -51,7 +47,6 @@ impl VhostUserEndpoint { } Ok(VhostUserEndpoint { - index, name: name.to_string(), guest_mac: guest_mac.to_string(), socket_path: socket_path.to_string(),