]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
mgr/dashboard: support clone_by_snap_id flag in clone API for group snapshots 69883/head
authorImran Imtiaz <imran.imtiaz@uk.ibm.com>
Wed, 1 Jul 2026 15:31:52 +0000 (16:31 +0100)
committerImran Imtiaz <imran.imtiaz@uk.ibm.com>
Thu, 2 Jul 2026 15:25:35 +0000 (16:25 +0100)
commit0b296db086913c6b03cc78e1f9ade9ab1c5123cf
tree5016d7943088d3832dd8478d86a0b508b3edf7d1
parenta0c37e5c723292a29c2aaa4bbc5c838b3e30aa70
mgr/dashboard: support clone_by_snap_id flag in clone API for group snapshots

The clone API endpoint POST /api/block/image/{image_spec}/snap/{snapshot_name}/clone
only accepted a snapshot name, which uses rbd_clone3 (clone by name). This only works
for snapshots in the user namespace.

Group snapshots (with .group prefix, in RBD_SNAP_NAMESPACE_TYPE_GROUP namespace)
require rbd_clone4 (clone by snap ID). The rbd Python binding already supports this:
passing an int for p_snapshot triggers rbd_clone4.

Add an optional clone_by_snap_id boolean flag to the clone endpoint. When set, the
path parameter is treated as a numeric snap ID and passed directly as an int to
rbd.RBD().clone(). Clone format 2 is enforced because this flag is intended for
non-user namespace snapshots which cannot be protected (a prerequisite for clone
format 1).

Usage:
  POST /api/block/image/{image_spec}/snap/{snap_id}/clone
  {"clone_by_snap_id": true, ...}

Fixes: https://tracker.ceph.com/issues/77875
Signed-off-by: Imran Imtiaz <imran.imtiaz@uk.ibm.com>
Assisted-by: IBM Bob
src/pybind/mgr/dashboard/controllers/rbd.py
src/pybind/mgr/dashboard/openapi.yaml