]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Create Default pool for Ceph Block 51879/head
authorAnkush Behl <cloudbehl@gmail.com>
Thu, 1 Jun 2023 14:22:21 +0000 (19:52 +0530)
committercloudbehl <cloudbehl@gmail.com>
Thu, 13 Jul 2023 10:38:04 +0000 (16:08 +0530)
- 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 <cloudbehl@gmail.com>
src/pybind/mgr/dashboard/controllers/rbd.py
src/pybind/mgr/dashboard/controllers/rbd_mirroring.py
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/block.module.ts

index 1c3d101e701095f5be88ef0301e77feb538ca778..d48d284ed2b834e13ca4a79117469d61a7d33555 100644 (file)
@@ -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")
index 2ee53fc1ad46efe5a8479688dd3ba00f2bb41eb9..e8250d4add8b273cba5eca42dcfbed2a1a565022 100644 (file)
@@ -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')
index 8a13f1c6925cbb83c367ed6551a412fd272d0c73..b9995ac029de96cd6d293b258f6931b217449a42 100644 (file)
@@ -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'