public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH qemu-server 1/2] restore: refactor archive parsing
@ 2023-06-20  7:41 Fabian Grünbichler
  2023-06-20  7:41 ` [pve-devel] [PATCH qemu-server 2/2] restore: extend permissions checks Fabian Grünbichler
  2023-06-20 19:01 ` [pve-devel] applied: [PATCH qemu-server 1/2] restore: refactor archive parsing Thomas Lamprecht
  0 siblings, 2 replies; 3+ messages in thread
From: Fabian Grünbichler @ 2023-06-20  7:41 UTC (permalink / raw)
  To: pve-devel

to avoid duplicate work, always set 'volid' to the backup volume's volid, if it
was successfully parsed as such.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 PVE/API2/Qemu.pm | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index d0c199bf..b7832d88 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -750,20 +750,20 @@ my $parse_restore_archive = sub {
 
     my ($archive_storeid, $archive_volname) = PVE::Storage::parse_volume_id($archive, 1);
 
+    my $res = {};
+
     if (defined($archive_storeid)) {
 	my $scfg =  PVE::Storage::storage_config($storecfg, $archive_storeid);
+	$res->{volid} = $archive;
 	if ($scfg->{type} eq 'pbs') {
-	    return {
-		type => 'pbs',
-		volid => $archive,
-	    };
+	    $res->{type} = 'pbs';
+	    return $res;
 	}
     }
     my $path = PVE::Storage::abs_filesystem_path($storecfg, $archive);
-    return {
-	type => 'file',
-	path => $path,
-    };
+    $res->{type} = 'file';
+    $res->{path} = $path;
+    return $res;
 };
 
 
-- 
2.39.2





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-20 19:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-20  7:41 [pve-devel] [PATCH qemu-server 1/2] restore: refactor archive parsing Fabian Grünbichler
2023-06-20  7:41 ` [pve-devel] [PATCH qemu-server 2/2] restore: extend permissions checks Fabian Grünbichler
2023-06-20 19:01 ` [pve-devel] applied: [PATCH qemu-server 1/2] restore: refactor archive parsing Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal