[pve-devel] [PATCH manager 04/10] make crush rules working again

Dominik Csapak d.csapak at proxmox.com
Mon Jul 31 11:28:36 CEST 2017


since ceph 12.1.1 the (deprecated) parameter 'crush_ruleset' is removed
and replaced with 'crush_rule' while changing this, change from
integer to string so that we can later use the names of the rules
instead of the id

(for now there seems to be a bug that you can only use the name and
not the id)

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/API2/Ceph.pm          | 22 ++++++++--------------
 www/manager6/ceph/Pool.js |  4 ++--
 2 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
index 8e792c4f..c7390981 100644
--- a/PVE/API2/Ceph.pm
+++ b/PVE/API2/Ceph.pm
@@ -1437,7 +1437,7 @@ __PACKAGE__->register_method ({
 	my $data = [];
 	foreach my $e (@{$res->{pools}}) {
 	    my $d = {};
-	    foreach my $attr (qw(pool pool_name size min_size pg_num crush_ruleset)) {
+	    foreach my $attr (qw(pool pool_name size min_size pg_num crush_rule)) {
 		$d->{$attr} = $e->{$attr} if defined($e->{$attr});
 	    }
 	    if (my $s = $stats->{$d->{pool}}) {
@@ -1494,12 +1494,9 @@ __PACKAGE__->register_method ({
 		minimum => 8,
 		maximum => 32768,
 	    },
-	    crush_ruleset => {
-		description => "The ruleset to use for mapping object placement in the cluster.",
-		type => 'integer',
-		minimum => 0,
-		maximum => 32768,
-		default => 0,
+	    crush_rule => {
+		description => "The rule to use for mapping object placement in the cluster.",
+		type => 'string',
 		optional => 1,
 	    },
 	},
@@ -1518,15 +1515,12 @@ __PACKAGE__->register_method ({
 	my $pg_num = $param->{pg_num} || 64;
 	my $size = $param->{size} || 2;
 	my $min_size = $param->{min_size} || 1;
-	my $ruleset = $param->{crush_ruleset} || 0;
 	my $rados = PVE::RADOS->new();
 
 	$rados->mon_command({
 	    prefix => "osd pool create",
 	    pool => $param->{name},
 	    pg_num => int($pg_num),
-# this does not work for unknown reason
-#	    properties => ["size=$size", "min_size=$min_size", "crush_ruleset=$ruleset"],
 	    format => 'plain',
 	});
 
@@ -1546,13 +1540,13 @@ __PACKAGE__->register_method ({
 	    format => 'plain',
 	});
 
-	if (defined($param->{crush_ruleset})) {
+	if (defined($param->{crush_rule})) {
 	    $rados->mon_command({
 		prefix => "osd pool set",
 		pool => $param->{name},
-		var => 'crush_ruleset',
-		val => $param->{crush_ruleset},
-	        format => 'plain',
+		var => 'crush_rule',
+		val => $param->{crush_rule},
+		format => 'plain',
 	    });
 	}
 
diff --git a/www/manager6/ceph/Pool.js b/www/manager6/ceph/Pool.js
index dff6ecc4..0cec0dc1 100644
--- a/www/manager6/ceph/Pool.js
+++ b/www/manager6/ceph/Pool.js
@@ -97,10 +97,10 @@ Ext.define('PVE.node.CephPoolList', {
 	    dataIndex: 'pg_num'
 	},
 	{
-	    header: 'ruleset',
+	    header: 'rule',
 	    width: 50,
 	    sortable: false,
-	    dataIndex: 'crush_ruleset'
+	    dataIndex: 'crush_rule'
 	},
 	{
 	    header: gettext('Used'),
-- 
2.11.0





More information about the pve-devel mailing list