]> git.proxmox.com Git - pve-storage.git/blobdiff - PVE/Storage/PBSPlugin.pm
fix #3307: make it possible to set protection for backups
[pve-storage.git] / PVE / Storage / PBSPlugin.pm
index ae45a1ad09c26802f2a08cb94ef5041838fa6dc6..76699e6e1e9365f40c3ad133a65065d181dc5d30 100644 (file)
@@ -45,7 +45,7 @@ sub properties {
            type => 'string',
        },
        'master-pubkey' => {
-           description => "Base64-encoded, PEM-formatted public RSA key. Used tp encrypt a copy of the encryption-key which will be added to each encrypted backup.",
+           description => "Base64-encoded, PEM-formatted public RSA key. Used to encrypt a copy of the encryption-key which will be added to each encrypted backup.",
            type => 'string',
        },
        port => {
@@ -565,7 +565,7 @@ sub path {
 
     my $repo = PVE::PBSClient::get_repository($scfg);
 
-    # artifical url - we currently do not use that anywhere
+    # artificial url - we currently do not use that anywhere
     my $path = "pbs://$repo/$name";
 
     return ($path, $vmid, $vtype);
@@ -595,6 +595,8 @@ sub free_image {
     my ($vtype, $name, $vmid) = $class->parse_volname($volname);
 
     run_client_cmd($scfg, $storeid, "forget", [ $name ], 1);
+
+    return;
 }
 
 
@@ -756,7 +758,7 @@ sub activate_storage {
        }
     }
 
-    die "$storeid: Cannot find datastore '$datastore', check permissions and existance!\n";
+    die "$storeid: Cannot find datastore '$datastore', check permissions and existence!\n";
 }
 
 sub deactivate_storage {
@@ -780,6 +782,8 @@ sub deactivate_volume {
     return 1;
 }
 
+# FIXME remove on the next APIAGE reset.
+# Deprecated, use get_volume_attribute instead.
 sub get_volume_notes {
     my ($class, $scfg, $storeid, $volname, $timeout) = @_;
 
@@ -790,6 +794,8 @@ sub get_volume_notes {
     return $data->{notes};
 }
 
+# FIXME remove on the next APIAGE reset.
+# Deprecated, use update_volume_attribute instead.
 sub update_volume_notes {
     my ($class, $scfg, $storeid, $volname, $notes, $timeout) = @_;
 
@@ -800,6 +806,26 @@ sub update_volume_notes {
     return undef;
 }
 
+sub get_volume_attribute {
+    my ($class, $scfg, $storeid, $volname, $attribute) = @_;
+
+    if ($attribute eq 'notes') {
+       return $class->get_volume_notes($scfg, $storeid, $volname);
+    }
+
+    return;
+}
+
+sub update_volume_attribute {
+    my ($class, $scfg, $storeid, $volname, $attribute, $value) = @_;
+
+    if ($attribute eq 'notes') {
+       return $class->update_volume_notes($scfg, $storeid, $volname, $value);
+    }
+
+    die "attribute '$attribute' is not supported for storage type '$scfg->{type}'\n";
+}
+
 sub volume_size_info {
     my ($class, $scfg, $storeid, $volname, $timeout) = @_;
 
@@ -809,7 +835,9 @@ sub volume_size_info {
 
     my $size = 0;
     foreach my $info (@$data) {
-       $size += $info->{size} if $info->{size};
+       if ($info->{size} && $info->{size} =~ /^(\d+)$/) { # untaints
+           $size += $1;
+       }
     }
 
     my $used = $size;