mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-11-04 19:11:11 +00:00
config, device_manager: Add support for disabling io_uring for testing
Add config parameter to --disk called "_disable_io_uring" (the underscore prefix indicating it is not for public consumpion.) Use this option to disable io_uring if it would otherwise be used. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
d1d0421103
commit
c622278030
@ -622,6 +622,9 @@ pub struct DiskConfig {
|
||||
pub poll_queue: bool,
|
||||
#[serde(default)]
|
||||
pub id: Option<String>,
|
||||
// For testing use only. Not exposed in API.
|
||||
#[serde(default)]
|
||||
pub disable_io_uring: bool,
|
||||
}
|
||||
|
||||
fn default_diskconfig_num_queues() -> usize {
|
||||
@ -649,6 +652,7 @@ impl Default for DiskConfig {
|
||||
vhost_socket: None,
|
||||
poll_queue: default_diskconfig_poll_queue(),
|
||||
id: None,
|
||||
disable_io_uring: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -671,7 +675,8 @@ impl DiskConfig {
|
||||
.add("vhost_user")
|
||||
.add("socket")
|
||||
.add("poll_queue")
|
||||
.add("id");
|
||||
.add("id")
|
||||
.add("_disable_io_uring");
|
||||
parser.parse(disk).map_err(Error::ParseDisk)?;
|
||||
|
||||
let path = parser.get("path").map(PathBuf::from);
|
||||
@ -710,6 +715,11 @@ impl DiskConfig {
|
||||
.unwrap_or_else(|| Toggle(default_diskconfig_poll_queue()))
|
||||
.0;
|
||||
let id = parser.get("id");
|
||||
let disable_io_uring = parser
|
||||
.convert::<Toggle>("_disable_io_uring")
|
||||
.map_err(Error::ParseDisk)?
|
||||
.unwrap_or(Toggle(false))
|
||||
.0;
|
||||
|
||||
if parser.is_set("poll_queue") && !vhost_user {
|
||||
warn!("poll_queue parameter currently only has effect when used vhost_user=true");
|
||||
@ -726,6 +736,7 @@ impl DiskConfig {
|
||||
vhost_user,
|
||||
poll_queue,
|
||||
id,
|
||||
disable_io_uring,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -1642,7 +1642,7 @@ impl DeviceManager {
|
||||
ImageType::Raw => {
|
||||
// Use asynchronous backend relying on io_uring if the
|
||||
// syscalls are supported.
|
||||
if block_io_uring_is_supported() {
|
||||
if block_io_uring_is_supported() && !disk_cfg.disable_io_uring {
|
||||
let dev = Arc::new(Mutex::new(
|
||||
virtio_devices::BlockIoUring::new(
|
||||
id.clone(),
|
||||
|
Loading…
Reference in New Issue
Block a user