import rbd
from .. import mgr
+from ..controllers.pool import RBDPool
from ..exceptions import DashboardException
from ..security import Scope
from ..services.ceph_service import CephService
status = {'available': True, 'message': None}
if not CephService.get_pool_list('rbd'):
status['available'] = False
- status['message'] = 'No RBD pools in the cluster. Please create a pool '\
- 'with the "rbd" application label.' # type: ignore
+ status['message'] = 'No Block Pool is available in the cluster. Please click ' \
+ 'on \"Configure Default Pool\" button to ' \
+ 'get started.' # type: ignore
return status
+ @Endpoint('POST')
+ @EndpointDoc('Configure Default Block Pool')
+ @CreatePermission
+ def configure(self):
+ rbd_pool = RBDPool()
+
+ if not CephService.get_pool_list('rbd'):
+ rbd_pool.create('rbd')
+
@APIRouter('/block/image/{image_spec}/snap', Scope.RBD_IMAGE)
@APIDoc("RBD Snapshot Management API", "RbdSnapshot")
return status
if not CephService.get_service_list('rbd-mirror') and not CephService.get_pool_list('rbd'):
status['available'] = False
- status['message'] = 'RBD mirroring is not configured' # type: ignore
+ status['message'] = 'No default "rbd" pool or "rbd-mirror" service ' \
+ 'in the cluster. Please click on ' \
+ '"Configure Block Mirroring" ' \
+ 'button to get started.' # type: ignore
return status
@Endpoint('POST')
moduleStatusGuardConfig: {
uiApiPath: 'block/rbd',
redirectTo: 'error',
- header: 'No RBD pools available',
- button_name: 'Create RBD pool',
- button_route: '/pool/create'
+ header: $localize`Block Pool is not configured`,
+ button_name: $localize`Configure Default pool`,
+ button_route: '/pool/create',
+ component: 'Default Pool',
+ uiConfig: true
},
breadcrumbs: 'Images'
},
moduleStatusGuardConfig: {
uiApiPath: 'block/mirroring',
redirectTo: 'error',
- header: $localize`RBD mirroring is not configured`,
- button_name: $localize`Configure RBD Mirroring`,
- button_title: $localize`This will create rbd-mirror service and a replicated RBD pool`,
- component: 'RBD Mirroring',
+ header: $localize`Block Mirroring is not configured`,
+ button_name: $localize`Configure Block Mirroring`,
+ button_title: $localize`This will create \"rbd-mirror\" service and a replicated Block pool`,
+ component: 'Block Mirroring',
uiConfig: true
},
breadcrumbs: 'Mirroring'