Use keyfile create/remove from CephTools
in the RBDPlugin, that is also shared by the CephFSPlugin Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
e34ce14443
commit
fe0d606f5e
@ -280,21 +280,7 @@ sub on_add_hook {
|
|||||||
|
|
||||||
return if defined($scfg->{monhost}); # nothing to do if not pve managed ceph
|
return if defined($scfg->{monhost}); # nothing to do if not pve managed ceph
|
||||||
|
|
||||||
my $ceph_admin_keyring = '/etc/pve/priv/ceph.client.admin.keyring';
|
PVE::Storage::CephTools::ceph_create_keyfile($scfg->{type}, $storeid);
|
||||||
my $ceph_storage_keyring = "/etc/pve/priv/ceph/${storeid}.keyring";
|
|
||||||
|
|
||||||
die "ceph authx keyring file for storage '$storeid' already exists!\n"
|
|
||||||
if -e $ceph_storage_keyring;
|
|
||||||
|
|
||||||
eval {
|
|
||||||
mkdir '/etc/pve/priv/ceph';
|
|
||||||
PVE::Tools::file_copy($ceph_admin_keyring, $ceph_storage_keyring);
|
|
||||||
};
|
|
||||||
if (my $err = $@) {
|
|
||||||
unlink $ceph_storage_keyring;
|
|
||||||
die "failed to copy ceph authx keyring for storage '$storeid': $err\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub on_delete_hook {
|
sub on_delete_hook {
|
||||||
@ -302,11 +288,7 @@ sub on_delete_hook {
|
|||||||
|
|
||||||
return if defined($scfg->{monhost}); # nothing to do if not pve managed ceph
|
return if defined($scfg->{monhost}); # nothing to do if not pve managed ceph
|
||||||
|
|
||||||
my $ceph_storage_keyring = "/etc/pve/priv/ceph/${storeid}.keyring";
|
PVE::Storage::CephTools::ceph_remove_keyfile($scfg->{type}, $storeid);
|
||||||
if (-f $ceph_storage_keyring) {
|
|
||||||
unlink($ceph_storage_keyring) or warn "removing keyring of storage failed: $!\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub parse_volname {
|
sub parse_volname {
|
||||||
|
|||||||
Reference in New Issue
Block a user