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:
Xuewei Niu
2026-07-21 09:27:42 -05:00
parent 7302fddeea
commit fbae7a2d52
2 changed files with 5 additions and 0 deletions

View File

@@ -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,

View File

@@ -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,