From e471c5dc16847ba35d3c3c8c74da1bf7c4c946e0 Mon Sep 17 00:00:00 2001 From: Yuan Zhou Date: Wed, 8 Jul 2015 10:35:49 +0800 Subject: [PATCH] librados: Make librados pool_create respect default_crush_ruleset Make pool_create in librados use the osd_pool_default_crush_replicated_ruleset Fixes: #11640 Signed-off-by: Yuan Zhou (cherry picked from commit da96a89033590277460aef1c80f385bd93d625e1) --- src/librados/RadosClient.cc | 4 ++-- src/librados/RadosClient.h | 10 ++++++++-- src/osdc/Objecter.h | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/librados/RadosClient.cc b/src/librados/RadosClient.cc index 8e63fce886cd4..3886b1ebe0142 100644 --- a/src/librados/RadosClient.cc +++ b/src/librados/RadosClient.cc @@ -551,7 +551,7 @@ bool librados::RadosClient::put() { } int librados::RadosClient::pool_create(string& name, unsigned long long auid, - __u8 crush_rule) + int16_t crush_rule) { int r = wait_for_osdmap(); if (r < 0) { @@ -578,7 +578,7 @@ int librados::RadosClient::pool_create(string& name, unsigned long long auid, int librados::RadosClient::pool_create_async(string& name, PoolAsyncCompletionImpl *c, unsigned long long auid, - __u8 crush_rule) + int16_t crush_rule) { int r = wait_for_osdmap(); if (r < 0) diff --git a/src/librados/RadosClient.h b/src/librados/RadosClient.h index f4eb0833c0a58..d44336f1977d8 100644 --- a/src/librados/RadosClient.h +++ b/src/librados/RadosClient.h @@ -101,9 +101,15 @@ public: int get_pool_stats(std::list& ls, map& result); int get_fs_stats(ceph_statfs& result); - int pool_create(string& name, unsigned long long auid=0, __u8 crush_rule=0); + /* + -1 was set as the default value and monitor will pickup the right crush rule with below order: + a) osd pool default crush replicated ruleset + b) the first ruleset in crush ruleset + c) error out if no value find + */ + int pool_create(string& name, unsigned long long auid=0, int16_t crush_rule=-1); int pool_create_async(string& name, PoolAsyncCompletionImpl *c, unsigned long long auid=0, - __u8 crush_rule=0); + int16_t crush_rule=-1); int pool_get_base_tier(int64_t pool_id, int64_t* base_tier); int pool_delete(const char *name); diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index 0aac5e95a4e8d..244efc4d9c8b2 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -1460,7 +1460,7 @@ public: Context *onfinish, *ontimeout; int pool_op; uint64_t auid; - __u8 crush_rule; + int16_t crush_rule; snapid_t snapid; bufferlist *blp; -- 2.39.5