From ddc99983228e761f754e0038aecbe341d7e2181f Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Thu, 23 Feb 2012 14:55:48 -0800 Subject: [PATCH] osd: conditionally encode old pg_pool_t when no CEPH_FEATURE_OSDENC This fixes OSDMap compatibility between v0.42 and Reviewed-by: Greg Farnum --- src/messages/MOSDMap.h | 11 ++++++++--- 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 f7838f7b7ae24..cd4a9519e1d5c 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 a54910007eaa2..0a8087933b045 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); -- 2.39.5