mirror of
https://github.com/kata-containers/kata-containers.git
synced 2026-07-25 22:49:59 +00:00
runtime-rs: Fix Clh network hotplug queue pair-to-virtqueue conversion
The network hotplug (handle_network_device) passed `queue_num`, a queue pair count, straight as `num_queues`, while cloud-hypervisor's virtio-net expects a raw virtqueue count. With the default network_queues=1 this hit "Number of queues (1) to virtio_net should be higher than 2" on the post-start netdev add, failing sandbox start. Convert the pair count to the raw queue count (queue_num.max(1) * 2), matching the coldplug path which already does network_queues_pairs * 2. Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
This commit is contained in:
@@ -317,8 +317,11 @@ impl CloudHypervisorInner {
|
||||
// When using fds to pass the tap device to cloud-hypervisor, tap and id fields should be None
|
||||
clh_net_config.tap = None;
|
||||
clh_net_config.id = None;
|
||||
// The `config.num_queues` is a queue *pair* count (1 RX + 1 TX per pair).
|
||||
// Convert pairs into the actual queue count.
|
||||
clh_net_config.num_queues = netdev.config.queue_num.max(1) * 2;
|
||||
|
||||
let files = open_named_tuntap(&netdev.config.host_dev_name, netdev.config.queue_num as u32)
|
||||
let files = open_named_tuntap(&netdev.config.host_dev_name, netdev.config.queue_num.max(1) as u32)
|
||||
.context("open named tuntap")?;
|
||||
|
||||
let fds = files.iter().map(|f| f.as_raw_fd()).collect();
|
||||
|
||||
Reference in New Issue
Block a user