]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
mgr/dashboard: expose image summary API 65323/head
authorNizamudeen A <nia@redhat.com>
Mon, 18 Aug 2025 07:47:01 +0000 (13:17 +0530)
committerNizamudeen A <nia@redhat.com>
Mon, 1 Sep 2025 15:59:56 +0000 (21:29 +0530)
commit504b26a1deaa00fd3e9f6e6984ef6d7ebdd90c21
treeeb3c5035c27941d16d540b092f30f07f3f6cb2c2
parent78c15dfd064132a8ee9900892836fa6ba8d51917
mgr/dashboard: expose image summary API

Introduce a new API for getting per image summary
```
╰─$ curl -kX GET "https://localhost:4200/api/block/mirroring/rbd/test/summary" \
-H "Accept: application/vnd.ceph.api.v1.0+json" \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" | jq .
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   637  100   637    0     0  14597      0 --:--:-- --:--:-- --:--:-- 14813
{
  "name": "test2",
  "id": "10d618ea1a58",
  "info": {
    "global_id": "f25678be-64a2-481f-b96c-9bcc566dcbfe",
    "state": 1,
    "primary": true
  },
  "remote_statuses": [
    {
      "state": "Replaying",
      "description": {
        "bytes_per_second": 0.0,
        "bytes_per_snapshot": 0.0,
        "last_snapshot_bytes": 0,
        "last_snapshot_sync_seconds": 0,
        "local_snapshot_timestamp": 1755579780,
        "remote_snapshot_timestamp": 1755579780,
        "replay_state": "idle"
      },
      "last_update": "2025-08-19T05:03:17Z",
      "up": true,
      "mirror_uuid": "4d734616-5a38-4399-b743-86bcd8c1ab8f"
    }
  ],
  "state": 6,
  "description": "local image is primary",
  "last_update": "2025-08-19T05:03:10Z",
  "up": true
}
```
Also update the existing API to add the image syncing status. The
/summary API's `image_ready` will also have the `remote_status` which is
a list of dict to show the status of all the remote clusters (one image
can be mirrored to more than one cluster)

```
"image_ready": [
            {
                "pool_name": "rbd",
                "name": "test2",
                "state_color": "info",
                "state": "Stopped",
                "mirror_mode": "snapshot",
                "description": "local image is primary",
                "remote_status": [
                    {
                        "state": "Replaying",
                        "description": {
                            "bytes_per_second": 0.0,
                            "bytes_per_snapshot": 0.0,
                            "last_snapshot_bytes": 0,
                            "last_snapshot_sync_seconds": 0,
                            "local_snapshot_timestamp": 1755579780,
                            "remote_snapshot_timestamp": 1755579780,
                            "replay_state": "idle"
                        },
                        "last_update": "2025-08-19T05:03:47Z",
                        "up": true,
                        "mirror_uuid": "4d734616-5a38-4399-b743-86bcd8c1ab8f"
                    }
                ]
            }
        ]
```

Fixes: https://tracker.ceph.com/issues/72520
Signed-off-by: Nizamudeen A <nia@redhat.com>
(cherry picked from commit f4b09da1521684a4dbae2fe5929484fb74783559)
src/pybind/mgr/dashboard/controllers/_base_controller.py
src/pybind/mgr/dashboard/controllers/rbd_mirroring.py
src/pybind/mgr/dashboard/openapi.yaml