mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
performance-metrics: Add QCOW2 backing file performance test
Add sequential and random read performance tests for QCOW2 overlays with QCOW2 backing files. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
@@ -319,7 +319,7 @@ mod adjuster {
|
||||
}
|
||||
}
|
||||
|
||||
const TEST_LIST: [PerformanceTest; 30] = [
|
||||
const TEST_LIST: [PerformanceTest; 32] = [
|
||||
PerformanceTest {
|
||||
name: "boot_time_ms",
|
||||
func_ptr: performance_boot_time,
|
||||
@@ -710,6 +710,36 @@ const TEST_LIST: [PerformanceTest; 30] = [
|
||||
},
|
||||
unit_adjuster: adjuster::identity,
|
||||
},
|
||||
PerformanceTest {
|
||||
name: "block_qcow2_backing_qcow2_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_QCOW2_BACKING,
|
||||
}),
|
||||
..PerformanceTestControl::default()
|
||||
},
|
||||
unit_adjuster: adjuster::Bps_to_MiBps,
|
||||
},
|
||||
PerformanceTest {
|
||||
name: "block_qcow2_backing_qcow2_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_QCOW2_BACKING,
|
||||
}),
|
||||
..PerformanceTestControl::default()
|
||||
},
|
||||
unit_adjuster: adjuster::Bps_to_MiBps,
|
||||
},
|
||||
];
|
||||
|
||||
fn run_test_with_timeout(
|
||||
|
||||
@@ -33,6 +33,8 @@ enum Error {
|
||||
// The test image cannot be created on tmpfs (e.g. /tmp) filesystem,
|
||||
// as tmpfs does not support O_DIRECT
|
||||
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";
|
||||
|
||||
pub fn init_tests(overrides: &PerformanceTestOverrides) {
|
||||
let mut cmd = format!("dd if=/dev/zero of={BLK_IO_TEST_IMG} bs=1M count=4096");
|
||||
@@ -54,11 +56,25 @@ pub fn init_tests(overrides: &PerformanceTestOverrides) {
|
||||
}
|
||||
|
||||
assert!(exec_host_command_output(&cmd).status.success());
|
||||
|
||||
// QCOW2 backing file for backing file tests
|
||||
cmd = format!("qemu-img create -f qcow2 -o preallocation=full {QCOW2_BACKING_FILE} 4G");
|
||||
assert!(exec_host_command_output(&cmd).status.success());
|
||||
|
||||
// QCOW2 overlay with QCOW2 backing
|
||||
cmd = format!(
|
||||
"qemu-img create -f qcow2 -b {QCOW2_BACKING_FILE} -F qcow2 {OVERLAY_WITH_QCOW2_BACKING} 4G"
|
||||
);
|
||||
assert!(exec_host_command_output(&cmd).status.success());
|
||||
}
|
||||
|
||||
pub fn cleanup_tests() {
|
||||
fs::remove_file(BLK_IO_TEST_IMG)
|
||||
.unwrap_or_else(|_| panic!("Failed to remove file '{BLK_IO_TEST_IMG}'."));
|
||||
fs::remove_file(QCOW2_BACKING_FILE)
|
||||
.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}'."));
|
||||
}
|
||||
|
||||
// Performance tests are expected to be executed sequentially, so we can
|
||||
|
||||
Reference in New Issue
Block a user