runtime-rs: Use vhost-net device by default

This patch set vhost-net as default backend of networking. It allows users
to set `disable_vhost_net` to `true` to reenable virtio-net backend.
Plus, which backend to use is a matter of hypervisor, runtime-rs will no
longer need to know that.

Fixes: #8608

Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
This commit is contained in:
Xuewei Niu
2023-12-11 10:07:02 +08:00
parent ee74fca92c
commit c11b066728
10 changed files with 45 additions and 61 deletions

View File

@@ -12,7 +12,7 @@ use async_trait::async_trait;
use hypervisor::device::device_manager::{do_handle_device, DeviceManager};
use hypervisor::device::driver::NetworkConfig;
use hypervisor::device::{DeviceConfig, DeviceType};
use hypervisor::{Backend, Hypervisor, NetworkDevice};
use hypervisor::{Hypervisor, NetworkDevice};
use tokio::sync::RwLock;
use super::endpoint_persist::{EndpointState, IpVlanEndpointState};
@@ -57,7 +57,6 @@ impl IPVlanEndpoint {
Ok(NetworkConfig {
host_dev_name: iface.name.clone(),
virt_iface_name: self.net_pair.virt_iface.name.clone(),
backend: Backend::Virtio,
guest_mac: Some(guest_mac),
..Default::default()
})

View File

@@ -12,7 +12,7 @@ use async_trait::async_trait;
use hypervisor::device::device_manager::{do_handle_device, DeviceManager};
use hypervisor::device::driver::NetworkConfig;
use hypervisor::device::{DeviceConfig, DeviceType};
use hypervisor::{Backend, Hypervisor, NetworkDevice};
use hypervisor::{Hypervisor, NetworkDevice};
use tokio::sync::RwLock;
use super::endpoint_persist::{EndpointState, MacvlanEndpointState};
@@ -56,7 +56,6 @@ impl MacVlanEndpoint {
Ok(NetworkConfig {
host_dev_name: iface.name.clone(),
virt_iface_name: self.net_pair.virt_iface.name.clone(),
backend: Backend::Virtio,
guest_mac: Some(guest_mac),
..Default::default()
})

View File

@@ -10,7 +10,7 @@ use anyhow::{Context, Result};
use async_trait::async_trait;
use hypervisor::device::device_manager::{do_handle_device, DeviceManager};
use hypervisor::device::{DeviceConfig, DeviceType};
use hypervisor::{Backend, Hypervisor, NetworkConfig, NetworkDevice};
use hypervisor::{Hypervisor, NetworkConfig, NetworkDevice};
use tokio::sync::RwLock;
use super::endpoint_persist::TapEndpointState;
@@ -76,7 +76,6 @@ impl TapEndpoint {
Ok(NetworkConfig {
host_dev_name: self.tap_iface.name.clone(),
virt_iface_name: self.name.clone(),
backend: Backend::Virtio,
guest_mac: Some(guest_mac),
queue_num: self.queue_num,
queue_size: self.queue_size,

View File

@@ -12,7 +12,7 @@ use async_trait::async_trait;
use hypervisor::device::device_manager::{do_handle_device, DeviceManager};
use hypervisor::device::driver::NetworkConfig;
use hypervisor::device::{DeviceConfig, DeviceType};
use hypervisor::{Backend, Hypervisor, NetworkDevice};
use hypervisor::{Hypervisor, NetworkDevice};
use tokio::sync::RwLock;
use super::endpoint_persist::{EndpointState, VethEndpointState};
@@ -56,7 +56,6 @@ impl VethEndpoint {
Ok(NetworkConfig {
host_dev_name: iface.name.clone(),
virt_iface_name: self.net_pair.virt_iface.name.clone(),
backend: Backend::Virtio,
guest_mac: Some(guest_mac),
..Default::default()
})

View File

@@ -12,7 +12,7 @@ use async_trait::async_trait;
use hypervisor::device::device_manager::{do_handle_device, DeviceManager};
use hypervisor::device::driver::NetworkConfig;
use hypervisor::device::{DeviceConfig, DeviceType};
use hypervisor::{Backend, Hypervisor, NetworkDevice};
use hypervisor::{Hypervisor, NetworkDevice};
use tokio::sync::RwLock;
use super::endpoint_persist::{EndpointState, VlanEndpointState};
@@ -56,7 +56,6 @@ impl VlanEndpoint {
Ok(NetworkConfig {
host_dev_name: iface.name.clone(),
virt_iface_name: self.net_pair.virt_iface.name.clone(),
backend: Backend::Virtio,
guest_mac: Some(guest_mac),
..Default::default()
})