mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-13 23:24:14 +00:00
dragonball: Set default queue config for vhost-net device
Dragonball sets a default queue config in the case of `None`. The queue_size and num_queues of vhost-net are set to `Some(0)` by default. Therefore, we might get an invalid queue config. This patch fixes this issue. Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
This commit is contained in:
parent
c11b066728
commit
82fde4431e
@ -128,9 +128,23 @@ impl From<&NetworkInterfaceConfig> for VhostNetDeviceConfigInfo {
|
|||||||
fn from(value: &NetworkInterfaceConfig) -> Self {
|
fn from(value: &NetworkInterfaceConfig) -> Self {
|
||||||
let num_queues = value
|
let num_queues = value
|
||||||
.num_queues
|
.num_queues
|
||||||
|
.map(|nq| {
|
||||||
|
if nq == 0 {
|
||||||
|
vhost_net_dev_mgr::DEFAULT_NUM_QUEUES
|
||||||
|
} else {
|
||||||
|
nq
|
||||||
|
}
|
||||||
|
})
|
||||||
.unwrap_or(vhost_net_dev_mgr::DEFAULT_NUM_QUEUES);
|
.unwrap_or(vhost_net_dev_mgr::DEFAULT_NUM_QUEUES);
|
||||||
let queue_size = value
|
let queue_size = value
|
||||||
.queue_size
|
.queue_size
|
||||||
|
.map(|qs| {
|
||||||
|
if qs == 0 {
|
||||||
|
vhost_net_dev_mgr::DEFAULT_QUEUE_SIZE
|
||||||
|
} else {
|
||||||
|
qs
|
||||||
|
}
|
||||||
|
})
|
||||||
.unwrap_or(vhost_net_dev_mgr::DEFAULT_QUEUE_SIZE);
|
.unwrap_or(vhost_net_dev_mgr::DEFAULT_QUEUE_SIZE);
|
||||||
|
|
||||||
// It is safe because we tested the type of config before.
|
// It is safe because we tested the type of config before.
|
||||||
|
Loading…
Reference in New Issue
Block a user