[pve-devel] [RFC manager 3/4] ceph tools: add check if erasure code profile exists

Aaron Lauterer a.lauterer at proxmox.com
Fri Apr 8 12:14:15 CEST 2022


Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
---
 PVE/Ceph/Tools.pm | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/PVE/Ceph/Tools.pm b/PVE/Ceph/Tools.pm
index 36d7788a..91aa6ce5 100644
--- a/PVE/Ceph/Tools.pm
+++ b/PVE/Ceph/Tools.pm
@@ -531,4 +531,14 @@ sub ceph_cluster_status {
     return $status;
 }
 
+sub ecprofile_exists {
+    my ($name) = @_;
+
+    my $rados = PVE::RADOS->new();
+    my $res = $rados->mon_command({ prefix => 'osd erasure-code-profile ls' });
+
+    my $profiles = { map { $_ => 1 } @$res };
+    return $profiles->{$name};
+};
+
 1;
-- 
2.30.2






More information about the pve-devel mailing list