Way back in
fc869dee1e8a1c90c93cb7e678563772fb1c51fb (v0.42) when we redid
the osd type encoding we forgot to make this conditionally encode the old
format for old clients. In particular, this means that kernel clients
will fail to decode the osdmap if there is a rados pool with a pool-level
snapshot defined.
Fixes: #3290
Signed-off-by: Sage Weil <sage@inktank.com>
}
}
template<class T, class U>
+inline void encode_nohead(const std::map<T,U>& m, bufferlist& bl, uint64_t features)
+{
+ for (typename std::map<T,U>::const_iterator p = m.begin(); p != m.end(); ++p) {
+ encode(p->first, bl, features);
+ encode(p->second, bl, features);
+ }
+}
+template<class T, class U>
inline void decode_nohead(int n, std::map<T,U>& m, bufferlist::iterator& p)
{
m.clear();
f->dump_string("name", name);
}
-void pool_snap_info_t::encode(bufferlist& bl) const
+void pool_snap_info_t::encode(bufferlist& bl, uint64_t features) const
{
+ if ((features & CEPH_FEATURE_PGPOOL3) == 0) {
+ __u8 struct_v = 1;
+ ::encode(struct_v, bl);
+ ::encode(snapid, bl);
+ ::encode(stamp, bl);
+ ::encode(name, bl);
+ return;
+ }
ENCODE_START(2, 2, bl);
::encode(snapid, bl);
::encode(stamp, bl);
::encode(auid, bl);
- ::encode_nohead(snaps, bl);
+ ::encode_nohead(snaps, bl, features);
removed_snaps.encode_nohead(bl);
return;
}
::encode(last_change, bl);
::encode(snap_seq, bl);
::encode(snap_epoch, bl);
- ::encode(snaps, bl);
+ ::encode(snaps, bl, features);
::encode(removed_snaps, bl);
::encode(auid, bl);
::encode(flags, bl);
::encode(last_change, bl);
::encode(snap_seq, bl);
::encode(snap_epoch, bl);
- ::encode(snaps, bl);
+ ::encode(snaps, bl, features);
::encode(removed_snaps, bl);
::encode(auid, bl);
::encode(flags, bl);
string name;
void dump(Formatter *f) const;
- void encode(bufferlist& bl) const;
+ void encode(bufferlist& bl, uint64_t features) const;
void decode(bufferlist::iterator& bl);
static void generate_test_instances(list<pool_snap_info_t*>& o);
};
-WRITE_CLASS_ENCODER(pool_snap_info_t)
+WRITE_CLASS_ENCODER_FEATURES(pool_snap_info_t)
inline ostream& operator<<(ostream& out, const pool_snap_info_t& si) {
return out << si.snapid << '(' << si.name << ' ' << si.stamp << ')';
TYPE(coll_t)
TYPE(osd_stat_t)
TYPE(OSDSuperblock)
-TYPE(pool_snap_info_t)
+TYPE_FEATUREFUL(pool_snap_info_t)
TYPE_FEATUREFUL(pg_pool_t)
TYPE(object_stat_sum_t)
TYPE(object_stat_collection_t)