]> git.proxmox.com Git - pve-storage.git/blobdiff - PVE/Storage/CephFSPlugin.pm
prune: introduce keep-all option
[pve-storage.git] / PVE / Storage / CephFSPlugin.pm
index 64ca03de8cb5bbfb99b79152aea64da4be5d20f4..880ec05266e557a5f4f1187fca32c697f1fa7b84 100644 (file)
@@ -7,11 +7,12 @@ use IO::File;
 use Net::IP;
 use File::Path;
 
-use PVE::Tools qw(run_command file_set_contents);
+use PVE::CephConfig;
+use PVE::JSONSchema qw(get_standard_option);
 use PVE::ProcFSTools;
 use PVE::Storage::Plugin;
-use PVE::JSONSchema qw(get_standard_option);
-use PVE::CephConfig;
+use PVE::Systemd;
+use PVE::Tools qw(run_command file_set_contents);
 
 use base qw(PVE::Storage::Plugin);
 
@@ -37,25 +38,6 @@ sub cephfs_is_mounted {
     return undef;
 }
 
-
-# FIXME: duplicate of api/diskmanage one, move to common helper (pve-common's
-#        Tools or Systemd ?)
-sub systemd_escape {
-    my ($val, $is_path) = @_;
-
-    # NOTE: this is not complete, but enough for our needs. normally all
-    # characters which are not alpha-numerical, '.' or '_' would need escaping
-    $val =~ s/\-/\\x2d/g;
-
-    if ($is_path) {
-       $val =~ s/^\///g;
-       $val =~ s/\/$//g;
-    }
-    $val =~ s/\//-/g;
-
-    return $val;
-}
-
 # FIXME: remove in PVE 7.0 where systemd is recent enough to not have those
 #        local-fs/remote-fs dependency cycles generated for _netdev mounts...
 sub systemd_netmount {
@@ -83,7 +65,7 @@ Type=${type}
 Options=${opts}
 EOF
 
-    my $unit_fn = systemd_escape($where, 1) . ".mount";
+    my $unit_fn = PVE::Systemd::escape_unit($where, 1) . ".mount";
     my $unit_path = "/run/systemd/system/$unit_fn";
     my $daemon_needs_reload = -e $unit_path;
 
@@ -116,7 +98,10 @@ sub cephfs_mount {
     } else {
        push @opts, "name=$cmd_option->{userid}";
        push @opts, "secretfile=$secretfile" if defined($secretfile);
-       push @opts, "conf=$configfile" if defined($configfile);
+
+       # FIXME: remove version check in PVE 7.0, only needed for Luminous -> Nautilus
+       my ($subversions) = PVE::CephConfig::local_ceph_version();
+       push @opts, "conf=$configfile" if defined($configfile) && @$subversions[0] > 12;
     }
 
     push @opts, $scfg->{options} if $scfg->{options};
@@ -165,6 +150,7 @@ sub options {
        fuse => { optional => 1 },
        bwlimit => { optional => 1 },
        maxfiles => { optional => 1 },
+       'prune-backups' => { optional => 1 },
     };
 }