[pve-devel] [PATCH container] fix regression breaking container restore from PBS

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Nov 17 19:40:34 CET 2025


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!




More information about the pve-devel mailing list