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>
This commit is contained in:
Rob Bradford
2026-02-08 21:14:28 +00:00
committed by Bo Chen
parent a702bf1d10
commit 509832298b
6 changed files with 68 additions and 20 deletions
+5 -1
View File
@@ -2657,6 +2657,10 @@ impl DeviceManager {
let image_type =
detect_image_type(&mut file).map_err(DeviceManagerError::DetectImageType)?;
if image_type != ImageType::Qcow2 && disk_cfg.backing_files {
warn!("Enabling backing_files option only applies for QCOW2 files");
}
let image = match image_type {
ImageType::FixedVhd => {
// Use asynchronous backend relying on io_uring if the
@@ -2710,7 +2714,7 @@ impl DeviceManager {
ImageType::Qcow2 => {
info!("Using synchronous QCOW2 disk file");
Box::new(
QcowDiskSync::new(file, disk_cfg.direct)
QcowDiskSync::new(file, disk_cfg.direct, disk_cfg.backing_files)
.map_err(DeviceManagerError::CreateQcowDiskSync)?,
) as Box<dyn DiskFile>
}