ALLOW_DISABLE_FEATURES = {"exclusive-lock", "object-map", "fast-diff", "deep-flatten",
"journaling"}
- def _rbd_list(self, pool_name=None, offset=0, limit=5, search='', sort=''):
+ DEFAULT_LIMIT = 5
+
+ def _rbd_list(self, pool_name=None, offset=0, limit=DEFAULT_LIMIT, search='', sort=''):
if pool_name:
pools = [pool_name]
else:
},
responses={200: RBD_SCHEMA})
@RESTController.MethodMap(version=APIVersion(2, 0)) # type: ignore
- def list(self, pool_name=None, offset: int = 0, limit: int = 5,
+ def list(self, pool_name=None, offset: int = 0, limit: int = DEFAULT_LIMIT,
search: str = '', sort: str = ''):
return self._rbd_list(pool_name, offset=offset, limit=limit, search=search, sort=sort)
from .ceph_service import CephService
try:
- from typing import List
+ from typing import List, Optional
except ImportError:
pass # For typing only
errno=errno.ENOENT)
@classmethod
- def _rbd_pool_image_refs(cls, pool_names: List[str], namespace=None):
+ def _rbd_pool_image_refs(cls, pool_names: List[str], namespace: Optional[str] = None):
joint_refs = []
rbd_inst = rbd.RBD()
for pool in pool_names:
return joint_refs
@classmethod
- def rbd_pool_list(cls, pool_names: List[str], namespace=None, offset=0, limit=0,
- search='', sort=''):
+ def rbd_pool_list(cls, pool_names: List[str], namespace: Optional[str] = None, offset: int = 0,
+ limit: int = 5, search: str = '', sort: str = ''):
offset = int(offset)
limit = int(limit)
# let's use -1 to denotate we want ALL images for now. Iscsi currently gathers
# all images therefore, we need this.
if limit < -1:
- return []
+ raise DashboardException(msg=f'Wrong limit value {limit}', code=400)
refs = cls._rbd_pool_image_refs(pool_names, namespace)
image_refs = []