]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: add API endpoint for consistency group name update 66533/head
authorImran Imtiaz <imran.imtiaz@uk.ibm.com>
Fri, 5 Dec 2025 08:46:40 +0000 (08:46 +0000)
committerImran Imtiaz <imran.imtiaz@uk.ibm.com>
Fri, 5 Dec 2025 12:31:47 +0000 (12:31 +0000)
Signed-off-by: Imran Imtiaz <imran.imtiaz@uk.ibm.com>
Fixes: https://tracker.ceph.com/issues/74121
Add a dashboard API endpoint to update (rename) consistency groups.

src/pybind/mgr/dashboard/controllers/rbd.py
src/pybind/mgr/dashboard/openapi.yaml

index 4c1bbadc82f8cca9c5df14ca69bb476f616b8955..fb8a6a3f78bf13cc30a19bebe9dec151c364ecb7 100644 (file)
@@ -533,6 +533,22 @@ class RbdGroup(RESTController):
             ioctx.set_namespace(namespace)
             return self.rbd_inst.group_create(ioctx, name)
 
+    @handle_rbd_error()
+    @EndpointDoc("Update a group",
+                 parameters={
+                     'pool_name': (str, 'Name of the pool'),
+                     'group_name': (str, 'Name of the group'),
+                     'new_name': (str, 'New name for the group'),
+                 },
+                 responses={200: None})
+    def set(self, pool_name, group_name, new_name, namespace=None):
+        with mgr.rados.open_ioctx(pool_name) as ioctx:
+            RbdService.validate_namespace(ioctx, namespace)
+            ioctx.set_namespace(namespace)
+            if new_name == group_name:
+                return None
+            return self.rbd_inst.group_rename(ioctx, group_name, new_name)
+
     @RESTController.Collection('POST', path='/{group_name}/image')
     @handle_rbd_error()
     @EndpointDoc("Add image to a group",
index da561a761c136441f11a0de5e07f86a1bc2d35d8..136877377e16f19bf9a55b8869ff537d2fa22cc7 100755 (executable)
@@ -1738,6 +1738,60 @@ paths:
       summary: Get the list of images in a group
       tags:
       - RbdGroup
+    put:
+      parameters:
+      - description: Name of the pool
+        in: path
+        name: pool_name
+        required: true
+        schema:
+          type: string
+      - description: Name of the group
+        in: path
+        name: group_name
+        required: true
+        schema:
+          type: string
+      requestBody:
+        content:
+          application/json:
+            schema:
+              properties:
+                namespace:
+                  type: string
+                new_name:
+                  description: New name for the group
+                  type: string
+              required:
+              - new_name
+              type: object
+      responses:
+        '200':
+          content:
+            application/vnd.ceph.api.v1.0+json:
+              schema:
+                properties: {}
+                type: object
+          description: Resource updated.
+        '202':
+          content:
+            application/vnd.ceph.api.v1.0+json:
+              type: object
+          description: Operation is still executing. Please check the task queue.
+        '400':
+          description: Operation exception. Please check the response body for details.
+        '401':
+          description: Unauthenticated access. Please login first.
+        '403':
+          description: Unauthorized access. Please check your permissions.
+        '500':
+          description: Unexpected error. Please check the response body for the stack
+            trace.
+      security:
+      - jwt: []
+      summary: Update a group
+      tags:
+      - RbdGroup
   /api/block/pool/{pool_name}/group/{group_name}/image:
     delete:
       parameters: