ceph / ceph/ceph-nvmeof

Need Ceph NVMeMon map response to be Json compatible

Open
#583 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
132
Forks
69
Avg merge
1d 7h
Merged PRs (30d)
47

Description

Need JSON reponse for the NVMeMON map command response, it might help us in easy way of parsing data.

```$ ceph nvme-gw show rbd ''
{
"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 "", line 1, in
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)
```

Contributor guide

Open the contributing guide

Research direction

Start with the implementation of the `ceph nvme-gw show` NVMeMON map command and trace how its response is formatted. Make the complete output valid JSON while preserving the pool, gateway, and ANA state data shown in the issue. Validate the result with Python's `json.loads` using the reproduced response.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.