restore: refactor archive parsing

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>
This commit is contained in:
Fabian Grünbichler 2023-06-20 09:41:48 +02:00 committed by Thomas Lamprecht
parent c961ab6d80
commit c36214d2a6

View File

@ -750,20 +750,20 @@ my $parse_restore_archive = sub {
my ($archive_storeid, $archive_volname) = PVE::Storage::parse_volume_id($archive, 1); my ($archive_storeid, $archive_volname) = PVE::Storage::parse_volume_id($archive, 1);
my $res = {};
if (defined($archive_storeid)) { if (defined($archive_storeid)) {
my $scfg = PVE::Storage::storage_config($storecfg, $archive_storeid); my $scfg = PVE::Storage::storage_config($storecfg, $archive_storeid);
$res->{volid} = $archive;
if ($scfg->{type} eq 'pbs') { if ($scfg->{type} eq 'pbs') {
return { $res->{type} = 'pbs';
type => 'pbs', return $res;
volid => $archive,
};
} }
} }
my $path = PVE::Storage::abs_filesystem_path($storecfg, $archive); my $path = PVE::Storage::abs_filesystem_path($storecfg, $archive);
return { $res->{type} = 'file';
type => 'file', $res->{path} = $path;
path => $path, return $res;
};
}; };