Am 17.11.25 um 14:53 schrieb Fabian Grünbichler:
> we should have
> 
> PVE::LXC::archive_is_oci_format($storage_cfg, $archive)
> 
> and then we can just inline that and have a combined
> 
> PVE::LXC::restore_oci_archive($storage_cfg, $archive, $conf)
> 
> that combines the two current helpers (extract_oci_config and
> merge_oci_conf_into_pct_conf) which are both only called once..

Ack.

> and we end up with 
> 
>                     if ($restore && $archive ne '-') {
>                         print "restoring '$archive' now..\n";
>                     } elsif (PVE::LXC::archive_is_oci_format($storage_cfg, 
> $archive) {
>                         print "Detected OCI archive\n";
>                         PVE::LXC::restore_oci_archive($storage_cfg, $archive, 
> $conf);
>                     } else {
>                         # Not an OCI image, so restore it as an LXC image 
> instead
>                         PVE::LXC::Create::restore_archive(
> 

This if-elsif-else chain is wrong though, i.e., the first one needs to be 
separate,
and can move in the else branch. I ended up with:

  if (
      !$restore # OCI image format is solely supported for fresh creation.
      && PVE::LXC::Create::archive_is_oci_format($storage_cfg, $archive)
  ) {
      print "Detected OCI archive\n";
      PVE::LXC::Create::restore_oci_archive(
          $storage_cfg, $archive, $rootdir, $conf,
      );
  } else {
      print "restoring '$archive' now..\n" if $restore && $archive ne '-';
      ....

I'd appreciate another look though!


_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to