"num_images": (int, '')
}]
+RBD_GROUP_GET_SCHEMA = [{
+ "group": (str, 'group name'),
+ "images": ([str], '')
+}]
+
# pylint: disable=not-callable
def RbdTask(name, metadata, wait_for): # noqa: N802
self.rbd_inst = rbd.RBD()
@handle_rbd_error()
- @EndpointDoc("Display RBD Groups by pool name",
+ @EndpointDoc("List groups by pool name",
parameters={
'pool_name': (str, 'Name of the pool'),
},
return result
@handle_rbd_error()
- @EndpointDoc("Create an RBD Group",
+ @EndpointDoc("Get the list of images in a group",
+ parameters={
+ 'pool_name': (str, 'Name of the pool'),
+ 'group_name': (str, 'Name of the group'),
+ },
+ responses={200: RBD_GROUP_GET_SCHEMA})
+ @RESTController.Collection('GET', path='/{group_name}')
+ def get(self, pool_name, group_name, namespace=None):
+ with mgr.rados.open_ioctx(pool_name) as ioctx:
+ RbdService.validate_namespace(ioctx, namespace)
+ ioctx.set_namespace(namespace)
+ result = []
+ groups = self.rbd_inst.group_list(ioctx)
+ if group_name in groups:
+ result.append({
+ 'group': group_name,
+ 'images': list(rbd.Group(ioctx, group_name).list_images())
+ })
+ else:
+ raise DashboardException(
+ msg='Group not found',
+ code='group_not_found',
+ component='rbd')
+ return result
+
+ @handle_rbd_error()
+ @EndpointDoc("Create a group",
parameters={
'pool_name': (str, 'Name of the pool'),
'name': (str, 'Name of the group'),
@RESTController.Collection('POST', path='/{group_name}/image')
@handle_rbd_error()
- @EndpointDoc("Add an image to an RBD Group",
+ @EndpointDoc("Add image to a group",
parameters={
'pool_name': (str, 'Name of the pool'),
'group_name': (str, 'Name of the group'),
trace.
security:
- jwt: []
- summary: Display RBD Groups by pool name
+ summary: List groups by pool name
tags:
- RbdGroup
post:
trace.
security:
- jwt: []
- summary: Create an RBD Group
+ summary: Create a group
+ tags:
+ - RbdGroup
+ /api/block/pool/{pool_name}/group/{group_name}:
+ get:
+ 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
+ - allowEmptyValue: true
+ in: query
+ name: namespace
+ schema:
+ type: string
+ responses:
+ '200':
+ content:
+ application/vnd.ceph.api.v1.0+json:
+ schema:
+ items:
+ properties:
+ group:
+ description: group name
+ type: string
+ images:
+ description: ''
+ items:
+ type: string
+ type: array
+ type: object
+ required:
+ - group
+ - images
+ type: array
+ description: OK
+ '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: Get the list of images in a group
tags:
- RbdGroup
/api/block/pool/{pool_name}/group/{group_name}/image:
trace.
security:
- jwt: []
- summary: Add an image to an RBD Group
+ summary: Add image to a group
tags:
- RbdGroup
/api/block/pool/{pool_name}/namespace: