ceph-nvmeof
ceph-nvmeof copied to clipboard
Need Ceph NVMeMon map response to be Json compatible
Need JSON reponse for the NVMeMON map command response, it might help us in easy way of parsing data.
{
"pool": "rbd",
"group": "",
"num gws": 2,
"Anagrp list": "[ 2 1 ]"
}
{
"gw-id": "client.nvmeof.rbd.ceph-sunilkumar-00-7v6gmf-node6.ltohgy",
"anagrp-id": 2,
"last-gw_map-epoch-valid": 1,
"Availability": "AVAILABLE",
"ana states": " 2: OWNER_FAILBACK_PREPARED , 1: STANDBY ,"
}
{
"gw-id": "client.nvmeof.rbd.ceph-sunilkumar-00-7v6gmf-node7.qraoia",
"anagrp-id": 1,
"last-gw_map-epoch-valid": 1,
"Availability": "AVAILABLE",
"ana states": " 2: WAIT_FAILBACK_PREPARED , 1: ACTIVE ,"
}
Validate Json fails
>>> import json
>>> data = """{
... "pool": "rbd",
... "group": "",
... "num gws": 2,
... "Anagrp list": "[ 2 1 ]"
... }
... {
... "gw-id": "client.nvmeof.rbd.ceph-sunilkumar-00-7v6gmf-node6.ltohgy",
... "anagrp-id": 2,
... "last-gw_map-epoch-valid": 1,
... "Availability": "AVAILABLE",
... "ana states": " 2: OWNER_FAILBACK_PREPARED , 1: STANDBY ,"
... }
... {
... "gw-id": "client.nvmeof.rbd.ceph-sunilkumar-00-7v6gmf-node7.qraoia",
... "anagrp-id": 1,
... "last-gw_map-epoch-valid": 1,
... "Availability": "AVAILABLE",
... "ana states": " 2: WAIT_FAILBACK_PREPARED , 1: ACTIVE ,"
... }"""
>>>
>>> json.loads(data)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python3.9/json/decoder.py", line 340, in decode
raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 7 column 1 (char 87)