Actions
Bug #6894
closed'ceph osd dump' produces malformed JSON if pool snapshots are present
% Done:
0%
Source:
Community (user)
Tags:
Backport:
Regression:
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):
Description
Example:
"pool_snaps": { "pool_snap_info": { "snapid": 1, "stamp": "2013-11-25 18:27:34.152418", "name": "test4.1"}, "pool_snap_info": { "snapid": 2, "stamp": "2013-11-25 18:27:36.370861", "name": "test4.2"}},
Note that this is a dict with two identical keys. Most parsers will silently drop all but one of the entries in this situation, and that is what happens when using ceph-rest-api (see http://lists.ceph.com/pipermail/ceph-users-ceph.com/2013-November/006209.html)
Updated by Dan Mick over 10 years ago
- Category changed from ceph cli to Monitor
This interested me, so I tried:
diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 0b45602..4950dea 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -669,7 +669,7 @@ void pg_pool_t::dump(Formatter *f) const f->dump_string("snap_mode", is_pool_snaps_mode() ? "pool" : "selfmanaged"); f->dump_unsigned("snap_seq", get_snap_seq()); f->dump_unsigned("snap_epoch", get_snap_epoch()); - f->open_object_section("pool_snaps"); + f->open_array_section("pool_snaps"); for (map<snapid_t, pool_snap_info_t>::const_iterator p = snaps.begin(); p != snaps.end(); ++p) { f->open_object_section("pool_snap_info"); p->second.dump(f);
which leads to:
"pool_snaps": [ { "snapid": 1, "stamp": "2013-11-25 21:25:39.715160", "name": "data1"}, { "snapid": 2, "stamp": "2013-11-25 21:25:42.746255", "name": "data2"}],
which seems better.
Updated by Dan Mick over 10 years ago
- Status changed from New to Fix Under Review
- Assignee set to Dan Mick
Updated by Loïc Dachary over 10 years ago
- Status changed from Fix Under Review to Resolved
Actions