]> git.proxmox.com Git - pve-storage.git/blobdiff - PVE/Storage/DirPlugin.pm
Storage/Plugin: add get/update_volume_comment and implement for dir
[pve-storage.git] / PVE / Storage / DirPlugin.pm
index 3c81d24a98ca7cd2bb4f2e29b5768af5eb758147..b36eec5fc60605edffaf053fbb370cf466e4965c 100644 (file)
@@ -87,6 +87,36 @@ sub parse_is_mountpoint {
     return $is_mp; # contains a path
 }
 
+sub get_volume_notes {
+    my ($class, $scfg, $storeid, $volname, $timeout) = @_;
+    my $path = $class->filesystem_path($scfg, $volname);
+    $path .= $class->SUPER::NOTES_EXT;
+
+    my $notes = "";
+
+    if (-f $path) {
+       $notes = PVE::Tools::file_get_contents($path);
+    }
+
+    return $notes;
+}
+
+sub update_volume_notes {
+    my ($class, $scfg, $storeid, $volname, $notes, $timeout) = @_;
+    my $path = $class->filesystem_path($scfg, $volname);
+    my ($vtype, undef, undef, undef, undef, undef, undef) = $class->parse_volname($volname);
+
+    if ($vtype ne 'backup') {
+       die "only backups can have notes\n";
+    }
+
+    $path .= $class->SUPER::NOTES_EXT;
+
+    PVE::Tools::file_set_contents($path, $notes);
+
+    return undef;
+}
+
 sub status {
     my ($class, $storeid, $scfg, $cache) = @_;