[pve-devel] [PATCH v2 storage 04/13] PBSPlugin: Add print_volid helper

Fabian Ebner f.ebner at proxmox.com
Wed Jun 10 13:23:55 CEST 2020


Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---

New in v2

 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 fba4b2b..f029e55 100644
--- a/PVE/Storage/PBSPlugin.pm
+++ b/PVE/Storage/PBSPlugin.pm
@@ -88,6 +88,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) = @_;
@@ -294,10 +302,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,
-- 
2.20.1





More information about the pve-devel mailing list