mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
performance-metrics: Add compressed async QCOW2 tempfile helper
Add compressed_qcow_async_tempfile which creates a zlib compressed QCOW2 image via qemu-img and opens it via QcowDiskAsync. Mirrors the existing compressed_qcow_tempfile for io_uring benchmarks. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
324f16861d
commit
4bf3672fad
@@ -257,6 +257,20 @@ pub fn compressed_qcow_tempfile(num_clusters: usize) -> (TempFile, QcowDiskSync)
|
||||
(tmp, disk)
|
||||
}
|
||||
|
||||
/// Compressed QCOW2 opened via QcowDiskAsync.
|
||||
pub fn compressed_qcow_async_tempfile(num_clusters: usize) -> (TempFile, QcowDiskAsync) {
|
||||
let tmp = create_compressed_qcow_tempfile(num_clusters);
|
||||
let path = tmp.as_path().to_str().unwrap().to_string();
|
||||
let disk = QcowDiskAsync::new(
|
||||
File::open(&path).expect("failed to open compressed qcow2"),
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
)
|
||||
.expect("failed to open compressed qcow2 via QcowDiskAsync");
|
||||
(tmp, disk)
|
||||
}
|
||||
|
||||
/// Number of data clusters covered by a single L2 table (64 KiB cluster,
|
||||
/// 8-byte entries -> 8192 entries per L2 table).
|
||||
pub const L2_ENTRIES_PER_TABLE: usize = QCOW_CLUSTER_SIZE as usize / 8;
|
||||
|
||||
Reference in New Issue
Block a user