OSD bug: extra null list makes json.loads failed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,
   There's one bug in OSD when requesting to get the osd crush tree
   result in json format. The result outputs an extra null list'[]' in
   the end of the output.
   Bug id: https://tracker.ceph.com/issues/38011
   Could someone take a look to try to solve it?

   Detail of example:
      1) command: ceph osd crush tree --format=json

	  2) result:
	     [{"id":-1,"name":"default","type":"root","type_id":10,"children":[]}][]

      3) json.loads failes to convert it into dictionary structure:
         >>> buggy_str = '[{"id":-1,"name":"default","type":"root","type_id":10,"children":[]}][]'
         >>> json.loads(buggy_str)
         Traceback (most recent call last):
           File "<stdin>", line 1, in <module>
           File "/usr/lib64/python2.7/json/__init__.py", line 338, in loads
             return _default_decoder.decode(s)
           File "/usr/lib64/python2.7/json/decoder.py", line 369, in decode
             raise ValueError(errmsg("Extra data", s, end, len(s)))
         ValueError: Extra data: line 1 column 70 - line 1 column 72 (char 69 - 71)

     4) The result should remove the extra null list []
         >>> good_str = '[{"id":-1,"name":"default","type":"root","type_id":10,"children":[]}]'
         >>> json.loads(good_str)
         [{u'children': [], u'type_id': 10, u'type': u'root', u'id': -1, u'name': u'default'}]
         >>>

B.R.
Changcheng



[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux