mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Add option to control backing files
Backing files (e.g. for QCOW2) interact badly with landlock since they
are not obvious from the initial VM configuration. Only enable their use
with an explicit option.
Signed-off-by: Rob Bradford <rbradford@meta.com>
Signed-off-by: Bo Chen <bchen@crusoe.ai>
(cherry picked from commit 509832298b)
This commit is contained in:
@@ -3412,6 +3412,7 @@ mod common_parallel {
|
||||
disable_io_uring: bool,
|
||||
disable_aio: bool,
|
||||
verify_os_disk: bool,
|
||||
backing_files: bool,
|
||||
) {
|
||||
let disk_config = UbuntuDiskConfig::new(image_name.to_string());
|
||||
let guest = Guest::new(Box::new(disk_config));
|
||||
@@ -3432,8 +3433,9 @@ mod common_parallel {
|
||||
.args([
|
||||
"--disk",
|
||||
format!(
|
||||
"path={}",
|
||||
guest.disk_config.disk(DiskType::OperatingSystem).unwrap()
|
||||
"path={},backing_files={}",
|
||||
guest.disk_config.disk(DiskType::OperatingSystem).unwrap(),
|
||||
if backing_files { "on"} else {"off"}
|
||||
)
|
||||
.as_str(),
|
||||
format!(
|
||||
@@ -3503,17 +3505,17 @@ mod common_parallel {
|
||||
|
||||
#[test]
|
||||
fn test_virtio_block_io_uring() {
|
||||
_test_virtio_block(FOCAL_IMAGE_NAME, false, true, false);
|
||||
_test_virtio_block(FOCAL_IMAGE_NAME, false, true, false, false);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_virtio_block_aio() {
|
||||
_test_virtio_block(FOCAL_IMAGE_NAME, true, false, false);
|
||||
_test_virtio_block(FOCAL_IMAGE_NAME, true, false, false, false);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_virtio_block_sync() {
|
||||
_test_virtio_block(FOCAL_IMAGE_NAME, true, true, false);
|
||||
_test_virtio_block(FOCAL_IMAGE_NAME, true, true, false, false);
|
||||
}
|
||||
|
||||
/// Uses `qemu-img check` to verify disk image consistency.
|
||||
@@ -3549,22 +3551,28 @@ mod common_parallel {
|
||||
|
||||
#[test]
|
||||
fn test_virtio_block_qcow2() {
|
||||
_test_virtio_block(JAMMY_IMAGE_NAME_QCOW2, false, false, true);
|
||||
_test_virtio_block(JAMMY_IMAGE_NAME_QCOW2, false, false, true, false);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_virtio_block_qcow2_zlib() {
|
||||
_test_virtio_block(JAMMY_IMAGE_NAME_QCOW2_ZLIB, false, false, true);
|
||||
_test_virtio_block(JAMMY_IMAGE_NAME_QCOW2_ZLIB, false, false, true, false);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_virtio_block_qcow2_zstd() {
|
||||
_test_virtio_block(JAMMY_IMAGE_NAME_QCOW2_ZSTD, false, false, true);
|
||||
_test_virtio_block(JAMMY_IMAGE_NAME_QCOW2_ZSTD, false, false, true, false);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_virtio_block_qcow2_backing_zstd_file() {
|
||||
_test_virtio_block(JAMMY_IMAGE_NAME_QCOW2_BACKING_ZSTD_FILE, false, false, true);
|
||||
_test_virtio_block(
|
||||
JAMMY_IMAGE_NAME_QCOW2_BACKING_ZSTD_FILE,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -3574,6 +3582,7 @@ mod common_parallel {
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3599,7 +3608,7 @@ mod common_parallel {
|
||||
.output()
|
||||
.expect("Expect generating VHD image from RAW image");
|
||||
|
||||
_test_virtio_block(FOCAL_IMAGE_NAME_VHD, false, false, false);
|
||||
_test_virtio_block(FOCAL_IMAGE_NAME_VHD, false, false, false, false);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -3623,7 +3632,7 @@ mod common_parallel {
|
||||
.output()
|
||||
.expect("Expect generating dynamic VHDx image from RAW image");
|
||||
|
||||
_test_virtio_block(FOCAL_IMAGE_NAME_VHDX, false, false, true);
|
||||
_test_virtio_block(FOCAL_IMAGE_NAME_VHDX, false, false, true, false);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user