mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-19 15:58:25 +00:00
runtime-rs: Support AIO for hotplugging block device within qemu
In this commit, block device aio are introduced within hotplug_block_device within qemu via qmp and the "iouring" is set the default. Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
This commit is contained in:
@@ -637,6 +637,7 @@ impl QemuInner {
|
||||
&self.config.blockdev_info.block_device_driver,
|
||||
&block_device.device_id,
|
||||
&block_device.config.path_on_host,
|
||||
&block_device.config.blkdev_aio.to_string(),
|
||||
block_device.config.is_direct,
|
||||
block_device.config.is_readonly,
|
||||
block_device.config.no_drop,
|
||||
|
@@ -13,10 +13,11 @@ use std::fmt::{Debug, Error, Formatter};
|
||||
use std::io::BufReader;
|
||||
use std::os::fd::{AsRawFd, RawFd};
|
||||
use std::os::unix::net::UnixStream;
|
||||
use std::str::FromStr;
|
||||
use std::time::Duration;
|
||||
|
||||
use qapi::qmp;
|
||||
use qapi_qmp::{self, PciDeviceInfo};
|
||||
use qapi_qmp::{self, BlockdevAioOptions, PciDeviceInfo};
|
||||
use qapi_spec::Dictionary;
|
||||
|
||||
/// default qmp connection read timeout
|
||||
@@ -514,11 +515,13 @@ impl Qmp {
|
||||
/// "bus": "pcie.1"
|
||||
/// }
|
||||
/// }
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn hotplug_block_device(
|
||||
&mut self,
|
||||
block_driver: &str,
|
||||
device_id: &str,
|
||||
path_on_host: &str,
|
||||
blkdev_aio: &str,
|
||||
is_direct: Option<bool>,
|
||||
is_readonly: bool,
|
||||
no_drop: bool,
|
||||
@@ -546,7 +549,9 @@ impl Qmp {
|
||||
};
|
||||
|
||||
let create_backend_options = || qapi_qmp::BlockdevOptionsFile {
|
||||
aio: None,
|
||||
aio: Some(
|
||||
BlockdevAioOptions::from_str(blkdev_aio).unwrap_or(BlockdevAioOptions::io_uring),
|
||||
),
|
||||
aio_max_batch: None,
|
||||
drop_cache: if !no_drop { None } else { Some(no_drop) },
|
||||
locking: None,
|
||||
|
Reference in New Issue
Block a user