MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / open_qcow2

Function open_qcow2

block/src/factory.rs:171–204  ·  view source on GitHub ↗
(
    file: fs::File,
    options: &DiskOpenOptions<'_>,
)

Source from the content-addressed store, hash-verified

169}
170
171fn open_qcow2(
172 file: fs::File,
173 options: &DiskOpenOptions<'_>,
174) -> BlockResult<Box<dyn AsyncFullDiskFile>> {
175 #[cfg(feature = "io_uring")]
176 if !options.disable_io_uring {
177 if io_uring_supported() {
178 info!("Opening QCOW2 disk file with io_uring backend");
179 return Ok(Box::new(
180 QcowDisk::new(
181 file,
182 options.direct,
183 options.backing_files,
184 options.sparse,
185 true,
186 )
187 .map_err(|e| e.with_path(options.path))?,
188 ));
189 }
190 info!("io_uring runtime probe failed for QCOW2, using synchronous backend");
191 }
192
193 info!("Opening QCOW2 disk file with synchronous backend");
194 Ok(Box::new(
195 QcowDisk::new(
196 file,
197 options.direct,
198 options.backing_files,
199 options.sparse,
200 false,
201 )
202 .map_err(|e| e.with_path(options.path))?,
203 ))
204}
205
206#[cfg(test)]
207mod unit_tests {

Callers 1

open_diskFunction · 0.85

Calls 3

io_uring_supportedFunction · 0.85
newFunction · 0.85
with_pathMethod · 0.80

Tested by

no test coverage detected