Add support of sparse files for QCow2 to sparse conversion

This commit is contained in:
Pierre HUBERT 2025-05-29 14:51:57 +02:00
parent b9353326f5
commit 80d81c34bb

View File

@ -181,9 +181,14 @@ impl DiskFileInfo {
}
// Convert QCow2 to Raw file
(DiskFileFormat::QCow2 { .. }, DiskFileFormat::Raw { .. }) => {
(DiskFileFormat::QCow2 { .. }, DiskFileFormat::Raw { is_sparse }) => {
let mut cmd = Command::new(constants::QEMU_IMAGE_PROGRAM);
cmd.arg("convert").arg(&self.file_path).arg(&temp_file);
if !is_sparse {
cmd.args(["-S", "0"]);
}
cmd
}