mirror of
https://github.com/kata-containers/kata-containers.git
synced 2026-07-26 07:30:19 +00:00
runtime-rs: Name vhost-user-net devices like the other backends
The virtio-net and vhost-net paths hand dragonball an iface_id taken from the virt interface name, but the vhost-user-net endpoint left dev_id unassigned, so the device carried no name of its own and was identified by its socket path inside the hypervisor. Assign dev_id from the endpoint's interface name so every network backend is identified the same way by a name the runtime knows. Also construct dragonball's vhost-user config with struct update syntax so this commit builds both before and after dragonball's config gains an iface_id field; the follow-up commit passes dev_id through explicitly once that field exists. Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
This commit is contained in:
@@ -359,6 +359,7 @@ impl DragonballInner {
|
||||
queue_size: Some(config.queue_size as u16),
|
||||
backend: dragonball::api::v1::Backend::VhostUser(DragonballVhostUserConfig {
|
||||
sock_path: config.socket_path.clone(),
|
||||
..Default::default()
|
||||
}),
|
||||
guest_mac,
|
||||
use_shared_irq: None,
|
||||
|
||||
@@ -58,6 +58,10 @@ impl VhostUserEndpoint {
|
||||
|
||||
fn get_network_config(&self) -> VhostUserConfig {
|
||||
VhostUserConfig {
|
||||
// Name the device after the virt interface, as the virtio-net and
|
||||
// vhost-net paths do, so the hypervisor identifies it by a name
|
||||
// the runtime knows rather than by its socket path.
|
||||
dev_id: self.name.clone(),
|
||||
socket_path: self.socket_path.clone(),
|
||||
mac_address: self.guest_mac.clone(),
|
||||
device_type: VhostUserType::Net,
|
||||
|
||||
Reference in New Issue
Block a user