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.



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to