Merge "virtualizationmanager: use raw file instead of qcow" into main
diff --git a/encryptedstore/README.md b/encryptedstore/README.md
index 544d6eb..3d55d85 100644
--- a/encryptedstore/README.md
+++ b/encryptedstore/README.md
@@ -5,7 +5,7 @@
Any data written in encrypted storage is persisted and is available next time the VM is run.
Encrypted Storage is backed by a para-virtualized block device on the guest which is further
-backed by a qcow2 disk image in the host. The block device is formatted with an ext4 filesystem.
+backed by a disk image file in the host. The block device is formatted with an ext4 filesystem.
## Security
diff --git a/virtualizationmanager/src/aidl.rs b/virtualizationmanager/src/aidl.rs
index 73d69b9..f939678 100644
--- a/virtualizationmanager/src/aidl.rs
+++ b/virtualizationmanager/src/aidl.rs
@@ -67,7 +67,6 @@
IntoBinderResult,
};
use cstr::cstr;
-use disk::QcowFile;
use glob::glob;
use lazy_static::lazy_static;
use log::{debug, error, info, warn};
@@ -256,15 +255,17 @@
.context("failed to move cursor to start")
.or_service_specific_exception(-1)?;
image.set_len(0).context("Failed to reset a file").or_service_specific_exception(-1)?;
-
- let mut part = QcowFile::new(image, size_bytes)
- .context("Failed to create QCOW2 image")
+ // Set the file length. In most filesystems, this will not allocate any physical disk
+ // space, it will only change the logical size.
+ image
+ .set_len(size_bytes)
+ .context("Failed to extend file")
.or_service_specific_exception(-1)?;
match partition_type {
PartitionType::RAW => Ok(()),
- PartitionType::ANDROID_VM_INSTANCE => format_as_android_vm_instance(&mut part),
- PartitionType::ENCRYPTEDSTORE => format_as_encryptedstore(&mut part),
+ PartitionType::ANDROID_VM_INSTANCE => format_as_android_vm_instance(&mut image),
+ PartitionType::ENCRYPTEDSTORE => format_as_encryptedstore(&mut image),
_ => Err(Error::new(
ErrorKind::Unsupported,
format!("Unsupported partition type {:?}", partition_type),