From 8602fd5646da51183d869114117f9ab216f44867 Mon Sep 17 00:00:00 2001 From: Fabian Ebner Date: Tue, 30 Jun 2020 10:24:20 +0200 Subject: [PATCH] PBSPlugin: Add print_volid helper Signed-off-by: Fabian Ebner --- PVE/Storage/PBSPlugin.pm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/PVE/Storage/PBSPlugin.pm b/PVE/Storage/PBSPlugin.pm index 65696f4..01dea2b 100644 --- a/PVE/Storage/PBSPlugin.pm +++ b/PVE/Storage/PBSPlugin.pm @@ -87,6 +87,14 @@ sub pbs_get_password { return PVE::Tools::file_read_firstline($pwfile); } +sub print_volid { + my ($storeid, $btype, $bid, $btime) = @_; + + my $time_str = strftime("%FT%TZ", gmtime($btime)); + my $volname = "backup/${btype}/${bid}/${time_str}"; + + return "${storeid}:${volname}"; +} sub run_raw_client_cmd { my ($scfg, $storeid, $client_cmd, $param, %opts) = @_; @@ -293,10 +301,7 @@ sub list_volumes { next if $bid !~ m/^\d+$/; next if defined($vmid) && $bid ne $vmid; - my $btime = strftime("%FT%TZ", gmtime($epoch)); - my $volname = "backup/${btype}/${bid}/${btime}"; - - my $volid = "$storeid:$volname"; + my $volid = print_volid($storeid, $btype, $bid, $epoch); my $info = { volid => $volid,