performance-metrics: Add RAW backing file performance tests

Add sequential and random read tests for QCOW2 overlays with
RAW backing files.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
Anatol Belski 2025-12-15 23:13:43 +01:00 committed by Rob Bradford
parent b3922dbd2c
commit 10394da0c4
2 changed files with 47 additions and 1 deletions

View file

@ -319,7 +319,7 @@ mod adjuster {
}
}
const TEST_LIST: [PerformanceTest; 32] = [
const TEST_LIST: [PerformanceTest; 34] = [
PerformanceTest {
name: "boot_time_ms",
func_ptr: performance_boot_time,
@ -740,6 +740,36 @@ const TEST_LIST: [PerformanceTest; 32] = [
},
unit_adjuster: adjuster::Bps_to_MiBps,
},
PerformanceTest {
name: "block_qcow2_backing_raw_read_MiBps",
func_ptr: performance_block_io,
control: PerformanceTestControl {
num_queues: Some(1),
queue_size: Some(128),
block_control: Some(BlockControl {
fio_ops: FioOps::Read,
bandwidth: true,
test_file: OVERLAY_WITH_RAW_BACKING,
}),
..PerformanceTestControl::default()
},
unit_adjuster: adjuster::Bps_to_MiBps,
},
PerformanceTest {
name: "block_qcow2_backing_raw_random_read_MiBps",
func_ptr: performance_block_io,
control: PerformanceTestControl {
num_queues: Some(1),
queue_size: Some(128),
block_control: Some(BlockControl {
fio_ops: FioOps::RandomRead,
bandwidth: true,
test_file: OVERLAY_WITH_RAW_BACKING,
}),
..PerformanceTestControl::default()
},
unit_adjuster: adjuster::Bps_to_MiBps,
},
];
fn run_test_with_timeout(

View file

@ -35,6 +35,8 @@ enum Error {
pub const BLK_IO_TEST_IMG: &str = "/var/tmp/ch-blk-io-test.img";
const QCOW2_BACKING_FILE: &str = "/var/tmp/ch-blk-io-test-qcow2-backing.qcow2";
pub const OVERLAY_WITH_QCOW2_BACKING: &str = "/var/tmp/ch-blk-io-test-overlay-qcow2.qcow2";
const RAW_BACKING_FILE: &str = "/var/tmp/ch-blk-io-test-raw-backing.raw";
pub const OVERLAY_WITH_RAW_BACKING: &str = "/var/tmp/ch-blk-io-test-overlay-raw.qcow2";
pub fn init_tests(overrides: &PerformanceTestOverrides) {
let mut cmd = format!("dd if=/dev/zero of={BLK_IO_TEST_IMG} bs=1M count=4096");
@ -66,6 +68,16 @@ pub fn init_tests(overrides: &PerformanceTestOverrides) {
"qemu-img create -f qcow2 -b {QCOW2_BACKING_FILE} -F qcow2 {OVERLAY_WITH_QCOW2_BACKING} 4G"
);
assert!(exec_host_command_output(&cmd).status.success());
// RAW backing file for backing file tests
cmd = format!("dd if=/dev/zero of={RAW_BACKING_FILE} bs=1M count=4096");
assert!(exec_host_command_output(&cmd).status.success());
// QCOW2 overlay with RAW backing
cmd = format!(
"qemu-img create -f qcow2 -b {RAW_BACKING_FILE} -F raw {OVERLAY_WITH_RAW_BACKING} 4G"
);
assert!(exec_host_command_output(&cmd).status.success());
}
pub fn cleanup_tests() {
@ -75,6 +87,10 @@ pub fn cleanup_tests() {
.unwrap_or_else(|_| panic!("Failed to remove file '{QCOW2_BACKING_FILE}'."));
fs::remove_file(OVERLAY_WITH_QCOW2_BACKING)
.unwrap_or_else(|_| panic!("Failed to remove file '{OVERLAY_WITH_QCOW2_BACKING}'."));
fs::remove_file(RAW_BACKING_FILE)
.unwrap_or_else(|_| panic!("Failed to remove file '{RAW_BACKING_FILE}'."));
fs::remove_file(OVERLAY_WITH_RAW_BACKING)
.unwrap_or_else(|_| panic!("Failed to remove file '{OVERLAY_WITH_RAW_BACKING}'."));
}
// Performance tests are expected to be executed sequentially, so we can