From: Ankush Behl Date: Thu, 1 Jun 2023 14:22:21 +0000 (+0530) Subject: mgr/dashboard: Create Default pool for Ceph Block X-Git-Tag: v19.0.0~875^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=2bc92f4a3d375d601b289df97cc134ac920fac33;p=ceph.git mgr/dashboard: Create Default pool for Ceph Block - Create Default pool "rbd" if your cluster doesn't have rbd pool - Fix the messaging consistency between block images and block mirroring Signed-off-by: Ankush Behl --- diff --git a/src/pybind/mgr/dashboard/controllers/rbd.py b/src/pybind/mgr/dashboard/controllers/rbd.py index 1c3d101e70109..d48d284ed2b83 100644 --- a/src/pybind/mgr/dashboard/controllers/rbd.py +++ b/src/pybind/mgr/dashboard/controllers/rbd.py @@ -11,6 +11,7 @@ import cherrypy import rbd from .. import mgr +from ..controllers.pool import RBDPool from ..exceptions import DashboardException from ..security import Scope from ..services.ceph_service import CephService @@ -205,10 +206,20 @@ class RbdStatus(BaseController): 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") diff --git a/src/pybind/mgr/dashboard/controllers/rbd_mirroring.py b/src/pybind/mgr/dashboard/controllers/rbd_mirroring.py index 2ee53fc1ad46e..e8250d4add8b2 100644 --- a/src/pybind/mgr/dashboard/controllers/rbd_mirroring.py +++ b/src/pybind/mgr/dashboard/controllers/rbd_mirroring.py @@ -651,7 +651,10 @@ class RbdMirroringStatus(BaseController): 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') diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/block.module.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/block.module.ts index 8a13f1c6925cb..b9995ac029de9 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/block.module.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/block.module.ts @@ -96,9 +96,11 @@ const routes: Routes = [ 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' }, @@ -154,10 +156,10 @@ const routes: Routes = [ 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'