]> git.proxmox.com Git - pve-storage.git/blobdiff - PVE/Storage/CephFSPlugin.pm
fix prune-backups validation (again)
[pve-storage.git] / PVE / Storage / CephFSPlugin.pm
index 54689aeecb21000e730a1d08b1ea1b93723247e0..3b9a791e1a61b0a27cabd4aac245bfdab064010d 100644 (file)
@@ -38,14 +38,13 @@ sub cephfs_is_mounted {
     return undef;
 }
 
-# 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...
+# FIXME: remove once it's possible to specify _netdev for fuse.ceph mounts
 sub systemd_netmount {
     my ($where, $type, $what, $opts) = @_;
 
 # don't do default deps, systemd v241 generator produces ordering deps on both
 # local-fs(-pre) and remote-fs(-pre) targets if we use the required _netdev
-# option. Over thre corners this gets us an ordering cycle on shutdown, which
+# option. Over three corners this gets us an ordering cycle on shutdown, which
 # may make shutdown hang if the random cycle breaking hits the "wrong" unit to
 # delete.
     my $unit =  <<"EOF";
@@ -80,7 +79,6 @@ EOF
 sub cephfs_mount {
     my ($scfg, $storeid) = @_;
 
-    my ($subversions) = PVE::CephConfig::ceph_version();
     my $mountpoint = $scfg->{path};
     my $subdir = $scfg->{subdir} // '/';
 
@@ -99,10 +97,7 @@ sub cephfs_mount {
     } else {
        push @opts, "name=$cmd_option->{userid}";
        push @opts, "secretfile=$secretfile" if defined($secretfile);
-       
-       # FIXME: remove subversion check in PVE 7.0, not needed for >= Nautilus
-       # Luminous doesn't know the conf option
-       push @opts, "conf=$configfile" if defined($configfile) && @$subversions[0] > 12;
+       push @opts, "conf=$configfile" if defined($configfile);
     }
 
     push @opts, $scfg->{options} if $scfg->{options};
@@ -151,6 +146,8 @@ sub options {
        fuse => { optional => 1 },
        bwlimit => { optional => 1 },
        maxfiles => { optional => 1 },
+       keyring => { optional => 1 },
+       'prune-backups' => { optional => 1 },
     };
 }
 
@@ -167,17 +164,30 @@ sub check_config {
 sub on_add_hook {
     my ($class, $storeid, $scfg, %param) = @_;
 
-    return if defined($scfg->{monhost}); # nothing to do if not pve managed ceph
+    my $secret = $param{keyring} if defined $param{keyring} // undef;
+    PVE::CephConfig::ceph_create_keyfile($scfg->{type}, $storeid, $secret);
 
-    PVE::CephConfig::ceph_create_keyfile($scfg->{type}, $storeid);
+    return;
 }
 
-sub on_delete_hook {
-    my ($class, $storeid, $scfg) = @_;
+sub on_update_hook {
+    my ($class, $storeid, $scfg, %param) = @_;
 
-    return if defined($scfg->{monhost}); # nothing to do if not pve managed ceph
+    if (exists($param{keyring})) {
+       if (defined($param{keyring})) {
+           PVE::CephConfig::ceph_create_keyfile($scfg->{type}, $storeid, $param{keyring});
+       } else {
+           PVE::CephConfig::ceph_remove_keyfile($scfg->{type}, $storeid);
+       }
+    }
+
+    return;
+}
 
+sub on_delete_hook {
+    my ($class, $storeid, $scfg) = @_;
     PVE::CephConfig::ceph_remove_keyfile($scfg->{type}, $storeid);
+    return;
 }
 
 sub status {
@@ -222,4 +232,14 @@ sub deactivate_storage {
     }
 }
 
+sub get_volume_notes {
+    my $class = shift;
+    PVE::Storage::DirPlugin::get_volume_notes($class, @_);
+}
+
+sub update_volume_notes {
+    my $class = shift;
+    PVE::Storage::DirPlugin::update_volume_notes($class, @_);
+}
+
 1;