]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: Make librados pool_create respect default_crush_ruleset 5165/head
authorYuan Zhou <yuan.zhou@intel.com>
Wed, 8 Jul 2015 02:35:49 +0000 (10:35 +0800)
committerYuan Zhou <yuan.zhou@intel.com>
Wed, 15 Jul 2015 00:00:34 +0000 (08:00 +0800)
Make pool_create in librados use the osd_pool_default_crush_replicated_ruleset

Fixes: #11640
Signed-off-by: Yuan Zhou <yuan.zhou@intel.com>
src/librados/RadosClient.cc
src/librados/RadosClient.h
src/osdc/Objecter.h

index 03f2b3c881c1d34c28159f33938a6f4472a0c12e..51c9f677a3905d26aeeccf9b77e47d49cdf48ddc 100644 (file)
@@ -553,7 +553,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) {
@@ -580,7 +580,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 76cadf68274443ae47d73fa8ab4229dd46e8ec55..7c49efb95c14dd2123cee629923819c08c1e5ded 100644 (file)
@@ -1462,7 +1462,7 @@ public:
     Context *onfinish, *ontimeout;
     int pool_op;
     uint64_t auid;
-    __u8 crush_rule;
+    int16_t crush_rule;
     snapid_t snapid;
     bufferlist *blp;