Actions
Bug #8942
closedBad JSON output in ceph osd tree
% Done:
0%
Source:
other
Tags:
Backport:
Regression:
Severity:
4 - irritation
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):
Description
Hi,
JSON output for ceph osd tree
has bad format for stray array: every osd are printed in the same array element.
"stray": [ { "id": 3, "name": "osd.3", "exists": 1, "type": "osd", "type_id": 0, "status": "down", "reweight": "0.000000", "id": 4, "name": "osd.4", "exists": 1, "type": "osd", "type_id": 0, "status": "down", "reweight": "0.000000"}]}
Updated by Loïc Dachary over 9 years ago
- Status changed from New to 12
- Priority changed from Low to High
Updated by Wyllys Ingersoll over 9 years ago
I see this in ceph version 0.80.5 (38b73c67d375a2552d8ed67843c8a65c2c0feba6)and it is indeed a problem.
I think the fix is in src/OSDMap.cc around the loop at line 2441:
if (!stray.empty()) { if (out) *out << "\n"; if (f) f->open_object_section("osd"); for (set<int>::iterator p = stray.begin(); p != stray.end(); ++p) { if (out) *out << *p << "\t0\t"; print_osd_line(*p, out, f); if (out) *out << "\n"; } if (f) f->close_section(); }
I think the "open_object_section("osd") should be inside the loop so that each stray is in its own section:
if (!stray.empty()) { if (out) *out << "\n"; for (set<int>::iterator p = stray.begin(); p != stray.end(); ++p) { if (out) *out << *p << "\t0\t"; if (f) f->open_object_section("osd"); print_osd_line(*p, out, f); if (out) *out << "\n"; if (f) f->close_section(); } }
Updated by Sage Weil about 9 years ago
- Assignee set to Sage Weil
- Priority changed from High to Urgent
Updated by Sage Weil about 9 years ago
- Status changed from 12 to Resolved
yeah looks ok now:
gnit:src (master) 08:54 PM $ ./ceph osd tree *** DEVELOPER MODE: setting PATH, PYTHONPATH and LD_LIBRARY_PATH *** # id weight type name up/down reweight primary-affinity -1 1 root default -2 1 host gnit 0 1 osd.0 up 1 1 1 0 osd.1 up 1 1 2 0 osd.2 up 1 1 gnit:src (master) 08:54 PM $ ./ceph osd tree -f json-pretty *** DEVELOPER MODE: setting PATH, PYTHONPATH and LD_LIBRARY_PATH *** { "nodes": [ { "id": -1, "name": "default", "type": "root", "type_id": 10, "children": [ -2 ] }, { "id": -2, "name": "gnit", "type": "host", "type_id": 1, "children": [ 0 ] }, { "id": 0, "name": "osd.0", "exists": 1, "type": "osd", "type_id": 0, "status": "up", "reweight": 1.000000, "primary_affinity": 1.000000, "crush_weight": 1.000000, "depth": 2 } ], "stray": [ { "id": 1, "name": "osd.1", "exists": 1, "type": "osd", "type_id": 0, "status": "up", "reweight": 1.000000, "primary_affinity": 1.000000 }, { "id": 2, "name": "osd.2", "exists": 1, "type": "osd", "type_id": 0, "status": "up", "reweight": 1.000000, "primary_affinity": 1.000000 } ] }
Actions