[pve-devel] [PATCH manager 10/20] ceph: add db/wal size helper

Dominik Csapak d.csapak at proxmox.com
Tue Jun 4 14:47:49 CEST 2019


reads the sizes from the ceph config db first, then from the
ceph config, first from the osd section then global

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/Ceph/Tools.pm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/PVE/Ceph/Tools.pm b/PVE/Ceph/Tools.pm
index 9610483a..6745875f 100644
--- a/PVE/Ceph/Tools.pm
+++ b/PVE/Ceph/Tools.pm
@@ -273,4 +273,32 @@ sub ceph_volume_zap {
     run_command($cmd);
 }
 
+sub get_db_wal_sizes {
+    my $res = {};
+
+    my $rados = PVE::RADOS->new();
+    my $db_config = $rados->mon_command({ prefix => 'config-key dump', key => 'config/' });
+
+    $res->{db} = $db_config->{"config/osd/bluestore_block_db_size"} //
+		 $db_config->{"config/global/bluestore_block_db_size"};
+
+    $res->{wal} = $db_config->{"config/osd/bluestore_block_wal_size"} //
+		  $db_config->{"config/global/bluestore_block_wal_size"};
+
+    if (!$res->{db} || !$res->{wal}) {
+	my $cfg = cfs_read_file('ceph.conf');
+	if (!$res->{db}) {
+	    $res->{db} = $cfg->{osd}->{bluestore_block_db_size} //
+			 $cfg->{global}->{bluestore_block_db_size};
+	}
+
+	if (!$res->{wal}) {
+	    $res->{wal} = $cfg->{osd}->{bluestore_block_wal_size} //
+			 $cfg->{global}->{bluestore_block_wal_size};
+	}
+    }
+
+    return $res;
+}
+
 1;
-- 
2.11.0





More information about the pve-devel mailing list