[pve-devel] [PATCH proxmox-perl-rs v2 02/11] add Perl mapping for OCI container image parser/extractor

Filip Schauer f.schauer at proxmox.com
Wed Jun 25 09:59:08 CEST 2025


On 24/06/2025 14:51, Wolfgang Bumiller wrote:
>> +    #[export]
>> +    pub fn parse_and_extract_image(
>> +        oci_tar_path: &str,
>> +        rootfs_path: &str,
>> +    ) -> Result<Option<Config>, Error> {
>> +        match proxmox_oci::parse_and_extract_image(oci_tar_path, rootfs_path) {
>> +            Ok(config) => Ok(Some(config.unwrap_or_default())),
>> +            Err(err) => match err {
>> +                ProxmoxOciError::ParseError(ParseError::NotAnOciImage(_)) => Ok(None),
> ^ Why are we doing this?

In the Perl code of the create_vm API method at PVE::API2::LXC, if a
.tar file is used as the container template,
PVE::RS::OCI::parse_and_extract_image is first attempted.
It returns undef, when the .tar file is not an OCI image. Thus we deduce
that the file is an LXC template. If some other kind of error occurrs,
(e.g. I/O error) then the Perl code should die.

The point is, there needs to be a way to differentiate between the file
actually being an LXC template, and some general failure.





More information about the pve-devel mailing list