]> git.proxmox.com Git - qemu-server.git/commitdiff
restore: check bridge access when actual config is available
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 8 Jun 2023 15:19:43 +0000 (17:19 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 8 Jun 2023 15:50:50 +0000 (17:50 +0200)
This was not only rather inefficient (getting the config from the
archive twice) but also wrong, as we can override options on restore,
so we can do the check only when the backed-up config and override
config got merged.

If this is to late from POV of volume deletion or the like, then the
issue is that those things happen to early, as we can only know what
to do with the actual target config, so destructive actions that
happen before that are wrong by design.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/API2/Qemu.pm
PVE/QemuServer.pm

index e7acf1fa7dc092275d221d88d70cbdd5960177d7..2be727726012a29a2f54db4f255e49eea126bf03 100644 (file)
@@ -866,10 +866,6 @@ __PACKAGE__->register_method({
                    'backup',
                );
 
-               my $vzdump_conf = PVE::Storage::extract_vzdump_config($storecfg, $archive);
-               my $backup_conf = PVE::QemuServer::parse_vm_config("restore/qemu-server/$vmid.conf", $vzdump_conf, 1);
-               PVE::QemuServer::check_bridge_access($rpcenv, $authuser, $backup_conf);
-
                $archive = $parse_restore_archive->($storecfg, $archive);
            }
        }
index df0e3bb34bffa364e4d8f3f88026361d3d250d03..b978ab54010b03e4186909ae7f5ccc19faa1615a 100644 (file)
@@ -7171,6 +7171,7 @@ sub restore_proxmox_backup_archive {
     }
 
     my $new_conf = $restore_merge_config->($conffile, $new_conf_raw, $options->{override_conf});
+    check_bridge_access($rpcenv, $user, $new_conf);
     PVE::QemuConfig->write_config($vmid, $new_conf);
 
     eval { rescan($vmid, 1); };
@@ -7484,6 +7485,7 @@ sub restore_vma_archive {
     }
 
     my $new_conf = $restore_merge_config->($conffile, $new_conf_raw, $opts->{override_conf});
+    check_bridge_access($rpcenv, $user, $new_conf);
     PVE::QemuConfig->write_config($vmid, $new_conf);
 
     eval { rescan($vmid, 1); };