systemimage module #13
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Module Overview
The systemimage module provides comprehensive image format conversion and export capabilities, enabling the creation of bootable images in various formats suitable for different deployment targets. This module handles the complex process of converting kernel, initramfs, and root filesystem artifacts into standardized image formats that can be deployed across cloud providers, virtualization platforms, and bare metal systems.
The module supports industry-standard formats including ISO for optical media and installation, QCOW2 for QEMU/KVM virtualization, raw for direct block device deployment, and VHD for Microsoft Hyper-V compatibility. It includes optimization features like compression, validation, and integrity verification to ensure reliable deployment.
Functionality
Module API
Image Export
ImageExporter::new(kernel: &Path, initramfs: &Path, rootfs: &Path) -> Self- Create a new image exporter with artifactsexport_to_iso(&self, output: &Path) -> Result<(), ExportError>- Export as bootable ISO imageexport_to_qcow2(&self, output: &Path, size: u64) -> Result<(), ExportError>- Export as QCOW2 virtual disk imageexport_to_raw(&self, output: &Path, size: u64) -> Result<(), ExportError>- Export as raw disk imageexport_to_vhd(&self, output: &Path, size: u64) -> Result<(), ExportError>- Export as VHD format for Hyper-Vcreate_bootable_image(&self, format: ImageFormat, output: &Path) -> Result<(), ExportError>- Create bootable image in specified formatadd_cloud_init_iso(&mut self, cloud_init: &Path) -> &mut Self- Attach cloud-init ISO to the imageFormat Conversion
convert_image(input: &Path, output: &Path, format: ImageFormat) -> Result<(), ConversionError>- Convert between image formatsqcow2_to_raw(input: &Path, output: &Path) -> Result<(), ConversionError>- Convert QCOW2 to raw formatraw_to_qcow2(input: &Path, output: &Path, compression: bool) -> Result<(), ConversionError>- Convert raw to QCOW2 with optional compressionvhd_to_qcow2(input: &Path, output: &Path) -> Result<(), ConversionError>- Convert VHD to QCOW2 formatresize_image(image: &Path, new_size: u64) -> Result<(), ConversionError>- Resize image to specified sizecompress_image(image: &Path, method: CompressionMethod) -> Result<PathBuf, ConversionError>- Compress image using specified methodImage Validation
validate_image(image: &Path) -> Result<ValidationReport, ValidationError>- Validate image structure and integritycheck_bootability(image: &Path) -> Result<bool, ValidationError>- Check if image is bootableverify_checksum(image: &Path, expected: &str) -> Result<bool, ValidationError>- Verify image checksumgenerate_checksum(image: &Path, algorithm: HashAlgorithm) -> Result<String, ValidationError>- Generate image checksumtoo many things at once, we need to think better what do we need first