diff options
author | Greg Farnum <gregory.farnum@dreamhost.com> | 2012-02-23 14:55:48 -0800 |
---|---|---|
committer | Greg Farnum <gregory.farnum@dreamhost.com> | 2012-02-23 14:55:48 -0800 |
commit | ddc99983228e761f754e0038aecbe341d7e2181f (patch) | |
tree | 88ae6fb621e02070f965632e2678d7f2d82cba2e | |
parent | b205c64c687cee1b1728877f14df050c3ce397da (diff) | |
download | ceph-ddc99983228e761f754e0038aecbe341d7e2181f.tar.gz |
osd: conditionally encode old pg_pool_t when no CEPH_FEATURE_OSDENC
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>
-rw-r--r-- | src/messages/MOSDMap.h | 11 | ||||
-rw-r--r-- | src/osd/osd_types.cc | 22 |
2 files changed, 30 insertions, 3 deletions
diff --git a/src/messages/MOSDMap.h b/src/messages/MOSDMap.h index f7838f7b7ae..cd4a9519e1d 100644 --- a/src/messages/MOSDMap.h +++ b/src/messages/MOSDMap.h @@ -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 // diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index a54910007ea..0a8087933b0 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -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); |