vmm: Improve resiliency of image type handling

Add an image_type to DiskConfig to specify the image type. If none is
specified autodetect the image type but disable potentially unsafe
behaviour in the QCOW2 backend by disabling the backing file support.

If the image type is autodetected then fix it in the config so that it
will be persistant across reboots and migrations/snapshot & restores.
This also handles the case where the image type was not specified as
part of the disk configuration.

Signed-off-by: Rob Bradford <rbradford@meta.com>
This commit is contained in:
Rob Bradford
2026-02-15 11:25:53 +00:00
committed by Bo Chen
parent e36096db3e
commit 6f2357c14e
7 changed files with 173 additions and 30 deletions
+3
View File
@@ -8,6 +8,7 @@ use std::path::{Path, PathBuf};
use std::str::FromStr;
use std::{fs, result};
use block::ImageType;
use log::{debug, warn};
use net_util::MacAddr;
use serde::{Deserialize, Serialize};
@@ -288,6 +289,8 @@ pub struct DiskConfig {
pub backing_files: bool,
#[serde(default = "default_diskconfig_sparse")]
pub sparse: bool,
#[serde(default)]
pub image_type: ImageType,
}
impl ApplyLandlock for DiskConfig {