]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: Make librados pool_create respect default_crush_ruleset 5754/head
authorYuan Zhou <yuan.zhou@intel.com>
Wed, 8 Jul 2015 02:35:49 +0000 (10:35 +0800)
committerLoic Dachary <ldachary@redhat.com>
Wed, 2 Sep 2015 06:19:52 +0000 (08:19 +0200)
Make pool_create in librados use the osd_pool_default_crush_replicated_ruleset

Fixes: #11640
Signed-off-by: Yuan Zhou <yuan.zhou@intel.com>
(cherry picked from commit da96a89033590277460aef1c80f385bd93d625e1)

src/librados/RadosClient.cc
src/librados/RadosClient.h
src/osdc/Objecter.h

index 8e63fce886cd41ef358acbc3fd41c3a7de464554..3886b1ebe01423b2c6480f9f99702fe0192a4dc5 100644 (file)
@@ -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)
index f4eb0833c0a582300afc6434ad040738519e4485..d44336f1977d830a20ab4717a87fa88cacaf2a0b 100644 (file)
@@ -101,9 +101,15 @@ public:
   int get_pool_stats(std::list<string>& ls, map<string,::pool_stat_t>& 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);
 
index 0aac5e95a4e8d5ea95275e54f9392cce646222b6..244efc4d9c8b286e79bc350f5d8b5ba3e52ea7ab 100644 (file)
@@ -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;