]> git.proxmox.com Git - pve-storage.git/blobdiff - PVE/Storage/DirPlugin.pm
drbd: comment that the builtin plugin is depreacated
[pve-storage.git] / PVE / Storage / DirPlugin.pm
index b3ddb5b3b25c7c722b0d94a3a2d4b2005687819b..2267f117c963e3e7a05a00f4a563149c5aca8163 100644 (file)
@@ -17,11 +17,11 @@ sub type {
 
 sub plugindata {
     return {
-       content => [ { images => 1, rootdir => 1, vztmpl => 1, iso => 1, backup => 1, none => 1 },
+       content => [ { images => 1, rootdir => 1, vztmpl => 1, iso => 1, backup => 1, snippets => 1, none => 1 },
                     { images => 1,  rootdir => 1 }],
        format => [ { raw => 1, qcow2 => 1, vmdk => 1, subvol => 1 } , 'raw' ],
     };
-}   
+}
 
 sub properties {
     return {
@@ -42,20 +42,23 @@ sub properties {
            type => 'string',
            default => 'no',
        },
+       bwlimit => get_standard_option('bwlimit'),
     };
 }
 
 sub options {
     return {
        path => { fixed => 1 },
-        nodes => { optional => 1 },
+       nodes => { optional => 1 },
        shared => { optional => 1 },
        disable => { optional => 1 },
-        maxfiles => { optional => 1 },
+       maxfiles => { optional => 1 },
+       'prune-backups' => { optional => 1 },
        content => { optional => 1 },
        format => { optional => 1 },
        mkdir => { optional => 1 },
        is_mountpoint => { optional => 1 },
+       bwlimit => { optional => 1 },
    };
 }
 
@@ -84,6 +87,34 @@ 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;
+
+    return PVE::Tools::file_get_contents($path) if -f $path;
+
+    return '';
+}
+
+sub update_volume_notes {
+    my ($class, $scfg, $storeid, $volname, $notes, $timeout) = @_;
+
+    my ($vtype) = $class->parse_volname($volname);
+    die "only backups can have notes\n" if $vtype ne 'backup';
+
+    my $path = $class->filesystem_path($scfg, $volname);
+    $path .= $class->SUPER::NOTES_EXT;
+
+    if (defined($notes) && $notes ne '') {
+       PVE::Tools::file_set_contents($path, $notes);
+    } else {
+       unlink $path or die "could not delete notes - $!\n";
+    }
+    return;
+}
+
 sub status {
     my ($class, $storeid, $scfg, $cache) = @_;
 
@@ -112,7 +143,7 @@ sub activate_storage {
            "directory is expected to be a mount point but is not mounted: '$mp'\n";
     }
 
-    $class->SUPER::activate_storage($storeid, $scfg, $cache);    
+    $class->SUPER::activate_storage($storeid, $scfg, $cache);
 }
 
 sub check_config {