block: qcow: Thread sparse configuration to QCOW2 constructors

Add sparse parameter to QcowFile constructors and propagate it from
device_manager through QcowDiskSync. This makes the sparse configuration
available throughout the QCOW2 implementation for controlling allocation
and deallocation behavior.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
Anatol Belski
2026-02-01 23:35:03 +01:00
committed by Rob Bradford
parent 46e6ecddfe
commit 0a287793df
3 changed files with 54 additions and 37 deletions

View File

@@ -2724,8 +2724,13 @@ impl DeviceManager {
ImageType::Qcow2 => {
info!("Using synchronous QCOW2 disk file");
Box::new(
QcowDiskSync::new(file, disk_cfg.direct, disk_cfg.backing_files)
.map_err(DeviceManagerError::CreateQcowDiskSync)?,
QcowDiskSync::new(
file,
disk_cfg.direct,
disk_cfg.backing_files,
disk_cfg.sparse,
)
.map_err(DeviceManagerError::CreateQcowDiskSync)?,
) as Box<dyn DiskFile>
}
ImageType::Vhdx => {