From: Thomas Lamprecht Date: Thu, 8 Jun 2023 15:19:43 +0000 (+0200) Subject: restore: check bridge access when actual config is available X-Git-Url: https://git.proxmox.com/?p=qemu-server.git;a=commitdiff_plain;h=951714ea9248634388c3148f6b143e61071acaf6 restore: check bridge access when actual config is available 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 --- diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index e7acf1f..2be7277 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -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); } } diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index df0e3bb..b978ab5 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -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); };