]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: conditionally encode old pg_pool_t when no CEPH_FEATURE_OSDENC
authorGreg Farnum <gregory.farnum@dreamhost.com>
Thu, 23 Feb 2012 22:55:48 +0000 (14:55 -0800)
committerGreg Farnum <gregory.farnum@dreamhost.com>
Thu, 23 Feb 2012 22:55:48 +0000 (14:55 -0800)
This fixes OSDMap compatibility between v0.42 and <v0.42.

For MOSDMap, reencode maps if OSDENC feature is missing.  Also rev the
message version.  We don't use COMPAT version here because v3 can't be
understood by v2 (that's why we're checking feature bits).  (It will be
possible to do that later when our constituent types can be decoded by
multiple versions.)

Fixes: #2095
Signed-off-by: Sage Weil <sage@newdream.net>
Reviewed-by: Greg Farnum <gregory.farnum@dreamhost.com>
src/messages/MOSDMap.h
src/osd/osd_types.cc

index f7838f7b7ae24f7b00a5a9cbd48de7fc03b304e5..cd4a9519e1d5cf53605667e7d55e08156726ff5f 100644 (file)
@@ -22,7 +22,7 @@
 
 class MOSDMap : public Message {
 
-  static const int HEAD_VERSION = 2;
+  static const int HEAD_VERSION = 3;
 
  public:
   uuid_d fsid;
@@ -85,8 +85,13 @@ public:
   void encode_payload(uint64_t features) {
     ::encode(fsid, payload);
     if ((features & CEPH_FEATURE_PGID64) == 0 ||
-       (features & CEPH_FEATURE_PGPOOL3) == 0) {
-      header.version = 1;
+       (features & CEPH_FEATURE_PGPOOL3) == 0 ||
+       (features & CEPH_FEATURE_OSDENC) == 0) {
+      if ((features & CEPH_FEATURE_PGID64) == 0 ||
+         (features & CEPH_FEATURE_PGPOOL3) == 0)
+       header.version = 1;  // old old_client version
+      else
+       header.version = 2;  // old pg_pool_t
 
       // reencode maps using old format
       //
index a54910007eaa25f380892da19c55b65903ec09d8..0a8087933b0455abd2c873dec2e52aa610f0fe17 100644 (file)
@@ -587,6 +587,28 @@ void pg_pool_t::encode(bufferlist& bl, uint64_t features) const
     return;
   }
 
+  if ((features & CEPH_FEATURE_OSDENC) == 0) {
+    __u8 struct_v = 4;
+    ::encode(struct_v, bl);
+    ::encode(type, bl);
+    ::encode(size, bl);
+    ::encode(crush_ruleset, bl);
+    ::encode(object_hash, bl);
+    ::encode(pg_num, bl);
+    ::encode(pgp_num, bl);
+    ::encode(lpg_num, bl);
+    ::encode(lpgp_num, bl);
+    ::encode(last_change, bl);
+    ::encode(snap_seq, bl);
+    ::encode(snap_epoch, bl);
+    ::encode(snaps, bl);
+    ::encode(removed_snaps, bl);
+    ::encode(auid, bl);
+    ::encode(flags, bl);
+    ::encode(crash_replay_interval, bl);
+    return;
+  }
+
   ENCODE_START(5, 5, bl);
   ::encode(type, bl);
   ::encode(size, bl);