]> git.proxmox.com Git - pve-storage.git/commitdiff
PBSPlugin: Add print_volid helper
authorFabian Ebner <f.ebner@proxmox.com>
Tue, 30 Jun 2020 08:24:20 +0000 (10:24 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 30 Jun 2020 11:59:23 +0000 (13:59 +0200)
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
PVE/Storage/PBSPlugin.pm

index 65696f40df007555d5fd7c65c44c9b9c12d3f51b..01dea2b1ba8a0b867a9648d01c5db2b2f80920c0 100644 (file)
@@ -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,