]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: obsolete pg_pool_t properties with erasure_code_profile
authorLoic Dachary <loic@dachary.org>
Sun, 16 Mar 2014 12:27:51 +0000 (13:27 +0100)
committerLoic Dachary <loic@dachary.org>
Mon, 17 Mar 2014 23:23:41 +0000 (00:23 +0100)
The generic map properties is only used for erasure code and should be
specialized. It is obsoleted by a string that can be looked up in
OSDMap::erasure_code_profiles to retrieve the key/value pairs that will
be interpreted by the erasure code plugin.

Signed-off-by: Loic Dachary <loic@dachary.org>
src/osd/osd_types.cc
src/osd/osd_types.h

index 9219602007cdcb7a0b5944b63f75480f398d6f58..f57ab0cf242bdc21234b080f4e0487661bf6ce6d 100644 (file)
@@ -785,14 +785,7 @@ void pg_pool_t::dump(Formatter *f) const
                   cache_target_full_ratio_micro);
   f->dump_unsigned("cache_min_flush_age", cache_min_flush_age);
   f->dump_unsigned("cache_min_evict_age", cache_min_evict_age);
-  f->open_object_section("properties");
-  for (map<string,string>::const_iterator i = properties.begin();
-       i != properties.end();
-       ++i) {
-    string name = i->first;
-    f->dump_string(name.c_str(), i->second);
-  }
-  f->close_section();
+  f->dump_string("erasure_code_profile", erasure_code_profile);
   f->open_object_section("hit_set_params");
   hit_set_params.dump(f);
   f->close_section(); // hit_set_params
@@ -1050,7 +1043,7 @@ void pg_pool_t::encode(bufferlist& bl, uint64_t features) const
   }
 
   __u8 encode_compat = 5;
-  ENCODE_START(13, encode_compat, bl);
+  ENCODE_START(14, encode_compat, bl);
   ::encode(type, bl);
   ::encode(size, bl);
   ::encode(crush_ruleset, bl);
@@ -1090,12 +1083,13 @@ void pg_pool_t::encode(bufferlist& bl, uint64_t features) const
   ::encode(cache_target_full_ratio_micro, bl);
   ::encode(cache_min_flush_age, bl);
   ::encode(cache_min_evict_age, bl);
+  ::encode(erasure_code_profile, bl);
   ENCODE_FINISH_NEW_COMPAT(bl, encode_compat);
 }
 
 void pg_pool_t::decode(bufferlist::iterator& bl)
 {
-  DECODE_START_LEGACY_COMPAT_LEN(13, 5, 5, bl);
+  DECODE_START_LEGACY_COMPAT_LEN(14, 5, 5, bl);
   ::decode(type, bl);
   ::decode(size, bl);
   ::decode(crush_ruleset, bl);
@@ -1189,6 +1183,9 @@ void pg_pool_t::decode(bufferlist::iterator& bl)
     cache_min_flush_age = 0;
     cache_min_evict_age = 0;
   }
+  if (struct_v >= 14) {
+    ::decode(erasure_code_profile, bl);
+  }
 
   DECODE_FINISH(bl);
   calc_pg_masks();
@@ -1231,8 +1228,6 @@ void pg_pool_t::generate_test_instances(list<pg_pool_t*>& o)
   a.cache_mode = CACHEMODE_WRITEBACK;
   a.read_tier = 1;
   a.write_tier = 1;
-  a.properties["p-1"] = "v-1";
-  a.properties["empty"] = string();
   a.hit_set_params = HitSet::Params(new BloomHitSet::Params);
   a.hit_set_period = 3600;
   a.hit_set_count = 8;
@@ -1243,6 +1238,7 @@ void pg_pool_t::generate_test_instances(list<pg_pool_t*>& o)
   a.cache_target_full_ratio_micro = 987222;
   a.cache_min_flush_age = 231;
   a.cache_min_evict_age = 2321;
+  a.erasure_code_profile = "profile in osdmap";
   o.push_back(new pg_pool_t(a));
 }
 
index af9e6fe8447d1e110108e231aa0fc9efadf99bdb..e055281ccea50ae5a9b370ddb98998710065326a 100644 (file)
@@ -878,7 +878,8 @@ private:
 
 
 public:
-  map<string,string> properties;  ///< interpreted according to the pool type
+  map<string,string> properties;  ///< OBSOLETE
+  string erasure_code_profile; ///< name of the erasure code profile in OSDMap
   epoch_t last_change;      ///< most recent epoch changed, exclusing snapshot changes
   snapid_t snap_seq;        ///< seq for per-pool snapshot
   epoch_t snap_epoch;       ///< osdmap epoch of last snap