From: Melissa Li Date: Thu, 26 May 2022 18:07:30 +0000 (-0400) Subject: mgr/dashboard: add rbd status endpoint X-Git-Tag: v16.2.11~103^2~28^2~4 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=ba109238cf7affe6fc8c3146d1f4a1274242bc84;p=ceph.git mgr/dashboard: add rbd status endpoint Show "No RBD pools available" error page when accessing block/rbd if there are no rbd pools. Add a "button_name" and "button_route" property to `ModuleStatusGuardService` config to customize the button on the error page. Modify `ModuleStatusGuardService` to execute API calls to `/ui-api//status` which uses the `UIRouter`. Fixes: https://tracker.ceph.com/issues/42109 Signed-off-by: Melissa Li (cherry picked from commit 6ac9b3cfe171a8902454ea907b3ba37d83eda3dc) --- diff --git a/qa/tasks/mgr/dashboard/test_orchestrator.py b/qa/tasks/mgr/dashboard/test_orchestrator.py index 8395853e3d673..2a804c4c2b83f 100644 --- a/qa/tasks/mgr/dashboard/test_orchestrator.py +++ b/qa/tasks/mgr/dashboard/test_orchestrator.py @@ -8,7 +8,7 @@ class OrchestratorControllerTest(DashboardTestCase): AUTH_ROLES = ['cluster-manager'] - URL_STATUS = '/api/orchestrator/status' + URL_STATUS = '/ui-api/orchestrator/status' ORCHESTRATOR = True diff --git a/qa/tasks/mgr/dashboard/test_rgw.py b/qa/tasks/mgr/dashboard/test_rgw.py index dc972d3ed0a41..53577a87a9617 100644 --- a/qa/tasks/mgr/dashboard/test_rgw.py +++ b/qa/tasks/mgr/dashboard/test_rgw.py @@ -84,7 +84,7 @@ class RgwApiCredentialsTest(RgwTestCase): # Set the default credentials. self._ceph_cmd_with_secret(['dashboard', 'set-rgw-api-secret-key'], 'admin') self._ceph_cmd_with_secret(['dashboard', 'set-rgw-api-access-key'], 'admin') - data = self._get('/api/rgw/status') + data = self._get('/ui-api/rgw/status') self.assertStatus(200) self.assertIn('available', data) self.assertIn('message', data) @@ -480,7 +480,7 @@ class RgwDaemonTest(RgwTestCase): self.assertTrue(data['rgw_metadata']) def test_status(self): - data = self._get('/api/rgw/status') + data = self._get('/ui-api/rgw/status') self.assertStatus(200) self.assertIn('available', data) self.assertIn('message', data) diff --git a/src/pybind/mgr/dashboard/controllers/nfs.py b/src/pybind/mgr/dashboard/controllers/nfs.py index 17221dbcb6eef..a609a46a5de35 100644 --- a/src/pybind/mgr/dashboard/controllers/nfs.py +++ b/src/pybind/mgr/dashboard/controllers/nfs.py @@ -82,31 +82,8 @@ def NfsTask(name, metadata, wait_for): # noqa: N802 return composed_decorator -@APIRouter('/nfs-ganesha', Scope.NFS_GANESHA) -@APIDoc("NFS-Ganesha Cluster Management API", "NFS-Ganesha") -class NFSGanesha(RESTController): - - @EndpointDoc("Status of NFS-Ganesha management feature", - responses={200: { - 'available': (bool, "Is API available?"), - 'message': (str, "Error message") - }}) - @Endpoint() - @ReadPermission - def status(self): - status = {'available': True, 'message': None} - try: - mgr.remote('nfs', 'cluster_ls') - except (ImportError, RuntimeError) as error: - logger.exception(error) - status['available'] = False - status['message'] = str(error) # type: ignore - - return status - - @APIRouter('/nfs-ganesha/cluster', Scope.NFS_GANESHA) -@APIDoc(group="NFS-Ganesha") +@APIDoc("NFS-Ganesha Cluster Management API", "NFS-Ganesha") class NFSGaneshaCluster(RESTController): @ReadPermission @RESTController.MethodMap(version=APIVersion.EXPERIMENTAL) @@ -286,3 +263,16 @@ class NFSGaneshaUi(BaseController): @ReadPermission def filesystems(self): return CephFS.list_filesystems() + + @Endpoint() + @ReadPermission + def status(self): + status = {'available': True, 'message': None} + try: + mgr.remote('nfs', 'cluster_ls') + except (ImportError, RuntimeError) as error: + logger.exception(error) + status['available'] = False + status['message'] = str(error) # type: ignore + + return status diff --git a/src/pybind/mgr/dashboard/controllers/orchestrator.py b/src/pybind/mgr/dashboard/controllers/orchestrator.py index 03eeaadbc0904..fe0794da59edc 100644 --- a/src/pybind/mgr/dashboard/controllers/orchestrator.py +++ b/src/pybind/mgr/dashboard/controllers/orchestrator.py @@ -5,7 +5,7 @@ from functools import wraps from ..exceptions import DashboardException from ..services.orchestrator import OrchClient -from . import APIDoc, APIRouter, Endpoint, EndpointDoc, ReadPermission, RESTController +from . import APIDoc, Endpoint, EndpointDoc, ReadPermission, RESTController, UIRouter STATUS_SCHEMA = { "available": (bool, "Orchestrator status"), @@ -36,7 +36,7 @@ def raise_if_no_orchestrator(features=None): return inner -@APIRouter('/orchestrator') +@UIRouter('/orchestrator') @APIDoc("Orchestrator Management API", "Orchestrator") class Orchestrator(RESTController): diff --git a/src/pybind/mgr/dashboard/controllers/rbd.py b/src/pybind/mgr/dashboard/controllers/rbd.py index b052ad6b363d0..3b3d4c35c52ee 100644 --- a/src/pybind/mgr/dashboard/controllers/rbd.py +++ b/src/pybind/mgr/dashboard/controllers/rbd.py @@ -20,8 +20,9 @@ from ..services.rbd import MIRROR_IMAGE_MODE, RbdConfiguration, \ format_features, get_image_spec, parse_image_spec, rbd_call, \ rbd_image_call from ..tools import ViewCache, str_to_bool -from . import APIDoc, APIRouter, CreatePermission, DeletePermission, \ - EndpointDoc, RESTController, Task, UpdatePermission, allow_empty_body +from . import APIDoc, APIRouter, BaseController, CreatePermission, \ + DeletePermission, Endpoint, EndpointDoc, ReadPermission, RESTController, \ + Task, UIRouter, UpdatePermission, allow_empty_body logger = logging.getLogger(__name__) @@ -303,6 +304,20 @@ class Rbd(RESTController): return rbd_call(pool_name, namespace, rbd_inst.trash_move, image_name, delay) +@UIRouter('/block/rbd') +class RbdStatus(BaseController): + @EndpointDoc("Display RBD Image feature status") + @Endpoint() + @ReadPermission + def status(self): + 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 + return status + + @APIRouter('/block/image/{image_spec}/snap', Scope.RBD_IMAGE) @APIDoc("RBD Snapshot Management API", "RbdSnapshot") class RbdSnapshot(RESTController): diff --git a/src/pybind/mgr/dashboard/controllers/rgw.py b/src/pybind/mgr/dashboard/controllers/rgw.py index 5f599b96c9416..d8b750100bc17 100644 --- a/src/pybind/mgr/dashboard/controllers/rgw.py +++ b/src/pybind/mgr/dashboard/controllers/rgw.py @@ -14,7 +14,7 @@ from ..services.ceph_service import CephService from ..services.rgw_client import NoRgwDaemonsException, RgwClient from ..tools import json_str_to_object, str_to_bool from . import APIDoc, APIRouter, BaseController, Endpoint, EndpointDoc, \ - ReadPermission, RESTController, allow_empty_body + ReadPermission, RESTController, UIRouter, allow_empty_body from ._version import APIVersion try: @@ -42,7 +42,7 @@ RGW_USER_SCHEMA = { } -@APIRouter('/rgw', Scope.RGW) +@UIRouter('/rgw', Scope.RGW) @APIDoc("RGW Management API", "Rgw") class Rgw(BaseController): @Endpoint() diff --git a/src/pybind/mgr/dashboard/frontend/cypress/fixtures/block-rbd-status.json b/src/pybind/mgr/dashboard/frontend/cypress/fixtures/block-rbd-status.json new file mode 100644 index 0000000000000..1d6f30b9a9021 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/cypress/fixtures/block-rbd-status.json @@ -0,0 +1 @@ +{ "available": false, "message": "No RBD pools in the cluster. Please create a pool with the \"rbd\" application label." } \ No newline at end of file diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/ui/navigation.po.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/ui/navigation.po.ts index a3673284cdfb3..a7ecf3af0e8d5 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/integration/ui/navigation.po.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/ui/navigation.po.ts @@ -35,7 +35,7 @@ export class NavigationPageHelper extends PageHelper { { menu: 'Block', submenus: [ - { menu: 'Images', component: 'cd-rbd-list' }, + { menu: 'Images', component: 'cd-error' }, { menu: 'Mirroring', component: 'cd-mirroring' }, { menu: 'iSCSI', component: 'cd-iscsi' } ] @@ -52,9 +52,10 @@ export class NavigationPageHelper extends PageHelper { } checkNavigations(navs: any) { - // The nfs-ganesha and RGW status requests are mocked to ensure that this method runs in time - cy.intercept('/api/nfs-ganesha/status', { fixture: 'nfs-ganesha-status.json' }); - cy.intercept('/api/rgw/status', { fixture: 'rgw-status.json' }); + // The nfs-ganesha, RGW, and block/rbd status requests are mocked to ensure that this method runs in time + cy.intercept('/ui-api/nfs-ganesha/status', { fixture: 'nfs-ganesha-status.json' }); + cy.intercept('/ui-api/rgw/status', { fixture: 'rgw-status.json' }); + cy.intercept('/ui-api/block/rbd/status', { fixture: 'block-rbd-status.json' }); navs.forEach((nav: any) => { cy.contains('.simplebar-content li.nav-item a', nav.menu).click(); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts b/src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts index 959cb37699702..4a490728b7cb4 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts @@ -96,7 +96,7 @@ const routes: Routes = [ canActivate: [ModuleStatusGuardService], data: { moduleStatusGuardConfig: { - apiPath: 'orchestrator', + uiApiPath: 'orchestrator', redirectTo: 'dashboard', backend: 'cephadm' }, @@ -126,7 +126,7 @@ const routes: Routes = [ canActivate: [ModuleStatusGuardService], data: { moduleStatusGuardConfig: { - apiPath: 'orchestrator', + uiApiPath: 'orchestrator', redirectTo: 'error', section: 'orch', section_info: 'Orchestrator', @@ -153,7 +153,7 @@ const routes: Routes = [ component: InventoryComponent, data: { moduleStatusGuardConfig: { - apiPath: 'orchestrator', + uiApiPath: 'orchestrator', redirectTo: 'error', section: 'orch', section_info: 'Orchestrator', @@ -298,7 +298,7 @@ const routes: Routes = [ canActivateChild: [FeatureTogglesGuardService, ModuleStatusGuardService], data: { moduleStatusGuardConfig: { - apiPath: 'rgw', + uiApiPath: 'rgw', redirectTo: 'error', section: 'rgw', section_info: 'Object Gateway', @@ -335,7 +335,7 @@ const routes: Routes = [ canActivateChild: [FeatureTogglesGuardService, ModuleStatusGuardService], data: { moduleStatusGuardConfig: { - apiPath: 'nfs-ganesha', + uiApiPath: 'nfs-ganesha', redirectTo: 'error', section: 'nfs-ganesha', section_info: 'NFS GANESHA', 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 40fffc2bce749..8a13f1c6925cb 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 @@ -9,6 +9,7 @@ import { NgxPipeFunctionModule } from 'ngx-pipe-function'; import { ActionLabels, URLVerbs } from '~/app/shared/constants/app.constants'; import { FeatureTogglesGuardService } from '~/app/shared/services/feature-toggles-guard.service'; +import { ModuleStatusGuardService } from '~/app/shared/services/module-status-guard.service'; import { SharedModule } from '~/app/shared/shared.module'; import { IscsiSettingComponent } from './iscsi-setting/iscsi-setting.component'; import { IscsiTabsComponent } from './iscsi-tabs/iscsi-tabs.component'; @@ -90,8 +91,17 @@ const routes: Routes = [ { path: '', redirectTo: 'rbd', pathMatch: 'full' }, { path: 'rbd', - canActivate: [FeatureTogglesGuardService], - data: { breadcrumbs: 'Images' }, + canActivate: [FeatureTogglesGuardService, ModuleStatusGuardService], + data: { + moduleStatusGuardConfig: { + uiApiPath: 'block/rbd', + redirectTo: 'error', + header: 'No RBD pools available', + button_name: 'Create RBD pool', + button_route: '/pool/create' + }, + breadcrumbs: 'Images' + }, children: [ { path: '', component: RbdListComponent }, { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.html b/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.html index 68436b26aea3f..0d63566acff36 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.html @@ -44,5 +44,6 @@ [routerLink]="'/dashboard'" i18n>Go To Dashboard + diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.ts index f06df9959127c..df0e03fa4363b 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.ts @@ -19,14 +19,14 @@ export class ErrorComponent implements OnDestroy, OnInit { message: string; section: string; section_info: string; + button_name: string; + button_route: string; icon: string; docUrl: string; source: string; routerSubscription: Subscription; bootstrap: string; uiApiPath: string; - button_route: string; - button_name: string; constructor(private router: Router, private docService: DocService, private http: HttpClient, @@ -78,6 +78,8 @@ export class ErrorComponent implements OnDestroy, OnInit { this.header = history.state.header; this.section = history.state.section; this.section_info = history.state.section_info; + this.button_name = history.state.button_name; + this.button_route = history.state.button_route; this.icon = history.state.icon; this.source = history.state.source; this.bootstrap = history.state.bootstrap; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/orchestrator.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/orchestrator.service.spec.ts index f4c7e4390ca18..c49cb8b0d8173 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/orchestrator.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/orchestrator.service.spec.ts @@ -7,7 +7,7 @@ import { OrchestratorService } from './orchestrator.service'; describe('OrchestratorService', () => { let service: OrchestratorService; let httpTesting: HttpTestingController; - const apiPath = 'api/orchestrator'; + const uiApiPath = 'ui-api/orchestrator'; configureTestBed({ providers: [OrchestratorService], @@ -29,7 +29,7 @@ describe('OrchestratorService', () => { it('should call status', () => { service.status().subscribe(); - const req = httpTesting.expectOne(`${apiPath}/status`); + const req = httpTesting.expectOne(`${uiApiPath}/status`); expect(req.request.method).toBe('GET'); }); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/orchestrator.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/orchestrator.service.ts index 2011715821512..a6e33e8342acb 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/orchestrator.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/orchestrator.service.ts @@ -11,7 +11,7 @@ import { OrchestratorStatus } from '../models/orchestrator.interface'; providedIn: 'root' }) export class OrchestratorService { - private url = 'api/orchestrator'; + private url = 'ui-api/orchestrator'; disableMessages = { noOrchestrator: $localize`The feature is disabled because Orchestrator is not available.`, diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/module-status-guard.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/module-status-guard.service.spec.ts index 8cce3a8bf8ca1..532aa6c6594b0 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/module-status-guard.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/module-status-guard.service.spec.ts @@ -67,7 +67,7 @@ describe('ModuleStatusGuardService', () => { route.url = []; route.data = { moduleStatusGuardConfig: { - apiPath: 'bar', + uiApiPath: 'bar', redirectTo: '/foo', backend: 'rook' } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/module-status-guard.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/module-status-guard.service.ts index e49879bbb6fa4..9d677aee53f7f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/module-status-guard.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/module-status-guard.service.ts @@ -10,7 +10,7 @@ import { Icons } from '~/app/shared/enum/icons.enum'; /** * This service checks if a route can be activated by executing a - * REST API call to '/api//status'. If the returned response + * REST API call to '/ui-api//status'. If the returned response * states that the module is not available, then the user is redirected * to the specified URL path. * @@ -26,7 +26,7 @@ import { Icons } from '~/app/shared/enum/icons.enum'; * canActivate: [AuthGuardService, ModuleStatusGuardService], * data: { * moduleStatusGuardConfig: { - * apiPath: 'rgw', + * uiApiPath: 'rgw', * redirectTo: 'rgw/501' * } * } @@ -71,7 +71,7 @@ export class ModuleStatusGuardService implements CanActivate, CanActivateChild { } ); } - return this.http.get(`api/${config.apiPath}/status`).pipe( + return this.http.get(`ui-api/${config.uiApiPath}/status`).pipe( map((resp: any) => { if (!resp.available && !backendCheck) { this.router.navigate([config.redirectTo || ''], { diff --git a/src/pybind/mgr/dashboard/openapi.yaml b/src/pybind/mgr/dashboard/openapi.yaml index 717fb2a8f97a0..7e3e73c00a25a 100644 --- a/src/pybind/mgr/dashboard/openapi.yaml +++ b/src/pybind/mgr/dashboard/openapi.yaml @@ -5708,74 +5708,6 @@ paths: summary: Updates an NFS-Ganesha export tags: - NFS-Ganesha - /api/nfs-ganesha/status: - get: - parameters: [] - responses: - '200': - content: - application/vnd.ceph.api.v1.0+json: - schema: - properties: - available: - description: Is API available? - type: boolean - message: - description: Error message - type: string - required: - - available - - message - type: object - 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: Status of NFS-Ganesha management feature - tags: - - NFS-Ganesha - /api/orchestrator/status: - get: - parameters: [] - responses: - '200': - content: - application/vnd.ceph.api.v1.0+json: - schema: - properties: - available: - description: Orchestrator status - type: boolean - message: - description: Error message - type: string - required: - - available - - message - type: object - 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: Display Orchestrator Status - tags: - - Orchestrator /api/osd: get: parameters: [] @@ -7134,26 +7066,9 @@ paths: application/json: schema: properties: - application_metadata: - type: string - configuration: - type: string - erasure_code_profile: - type: string - flags: - type: string - pg_num: - type: integer pool: + default: rbd-mirror type: string - pool_type: - type: string - rule_name: - type: string - required: - - pool - - pg_num - - pool_type type: object responses: '201': @@ -7795,40 +7710,6 @@ paths: - jwt: [] tags: - RgwSite - /api/rgw/status: - get: - parameters: [] - responses: - '200': - content: - application/vnd.ceph.api.v1.0+json: - schema: - properties: - available: - description: Is RGW available? - type: boolean - message: - description: Descriptions - type: string - required: - - available - - message - type: object - 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: Display RGW Status - tags: - - Rgw /api/rgw/user: get: parameters: @@ -10390,8 +10271,6 @@ tags: name: NFS-Ganesha - description: OSD management API name: OSD -- description: Orchestrator Management API - name: Orchestrator - description: OSD Perf Counters Management API name: OsdPerfCounter - description: Perf Counters Management API @@ -10420,8 +10299,6 @@ tags: name: RbdSnapshot - description: RBD Trash Management API name: RbdTrash -- description: RGW Management API - name: Rgw - description: RGW Bucket Management API name: RgwBucket - description: RGW Daemon Management API diff --git a/src/pybind/mgr/dashboard/plugins/feature_toggles.py b/src/pybind/mgr/dashboard/plugins/feature_toggles.py index 0cce9244469dd..fc4619be3f9f8 100644 --- a/src/pybind/mgr/dashboard/plugins/feature_toggles.py +++ b/src/pybind/mgr/dashboard/plugins/feature_toggles.py @@ -9,7 +9,7 @@ from mgr_module import CLICommand, Option from ..controllers.cephfs import CephFS from ..controllers.iscsi import Iscsi, IscsiTarget -from ..controllers.nfs import NFSGanesha, NFSGaneshaExports +from ..controllers.nfs import NFSGaneshaExports, NFSGaneshaUi from ..controllers.rbd import Rbd, RbdSnapshot, RbdTrash from ..controllers.rbd_mirroring import RbdMirroringPoolMode, \ RbdMirroringPoolPeer, RbdMirroringSummary @@ -42,7 +42,7 @@ Feature2Controller = { Features.ISCSI: [Iscsi, IscsiTarget], Features.CEPHFS: [CephFS], Features.RGW: [Rgw, RgwDaemon, RgwBucket, RgwUser], - Features.NFS: [NFSGanesha, NFSGaneshaExports], + Features.NFS: [NFSGaneshaUi, NFSGaneshaExports], } diff --git a/src/pybind/mgr/dashboard/tests/test_nfs.py b/src/pybind/mgr/dashboard/tests/test_nfs.py index c0103653f96d6..5e71b6525c234 100644 --- a/src/pybind/mgr/dashboard/tests/test_nfs.py +++ b/src/pybind/mgr/dashboard/tests/test_nfs.py @@ -6,7 +6,7 @@ from urllib.parse import urlencode from .. import mgr from ..controllers._version import APIVersion -from ..controllers.nfs import NFSGanesha, NFSGaneshaExports, NFSGaneshaUi +from ..controllers.nfs import NFSGaneshaExports, NFSGaneshaUi from ..tests import ControllerTestCase from ..tools import NotificationQueue, TaskManager @@ -228,19 +228,13 @@ class NFSGaneshaUiControllerTest(ControllerTestCase): self.assertStatus(200) self.assertJsonBody({'paths': []}) - -class NFSGaneshaControllerTest(ControllerTestCase): - @classmethod - def setup_server(cls): - cls.setup_controllers([NFSGanesha]) - def test_status_available(self): - self._get('/api/nfs-ganesha/status') + self._get('/ui-api/nfs-ganesha/status') self.assertStatus(200) self.assertJsonBody({'available': True, 'message': None}) def test_status_not_available(self): mgr.remote = Mock(side_effect=RuntimeError('Test')) - self._get('/api/nfs-ganesha/status') + self._get('/ui-api/nfs-ganesha/status') self.assertStatus(200) self.assertJsonBody({'available': False, 'message': 'Test'}) diff --git a/src/pybind/mgr/dashboard/tests/test_orchestrator.py b/src/pybind/mgr/dashboard/tests/test_orchestrator.py index ded06ba50e493..53e32c85ae6ea 100644 --- a/src/pybind/mgr/dashboard/tests/test_orchestrator.py +++ b/src/pybind/mgr/dashboard/tests/test_orchestrator.py @@ -10,7 +10,7 @@ from ..tests import ControllerTestCase class OrchestratorControllerTest(ControllerTestCase): - URL_STATUS = '/api/orchestrator/status' + URL_STATUS = '/ui-api/orchestrator/status' URL_INVENTORY = '/api/orchestrator/inventory' @classmethod diff --git a/src/pybind/mgr/dashboard/tests/test_rgw.py b/src/pybind/mgr/dashboard/tests/test_rgw.py index 0f500a6545cda..ce1b5fd928fdd 100644 --- a/src/pybind/mgr/dashboard/tests/test_rgw.py +++ b/src/pybind/mgr/dashboard/tests/test_rgw.py @@ -20,7 +20,7 @@ class RgwControllerTestCase(ControllerTestCase): @patch.object(RgwClient, 'is_service_online', Mock(return_value=True)) @patch.object(RgwClient, '_is_system_user', Mock(return_value=True)) def test_status_available(self): - self._get('/test/api/rgw/status') + self._get('/test/ui-api/rgw/status') self.assertStatus(200) self.assertJsonBody({'available': True, 'message': None}) @@ -28,7 +28,7 @@ class RgwControllerTestCase(ControllerTestCase): @patch.object(RgwClient, 'is_service_online', Mock( side_effect=RequestException('My test error'))) def test_status_online_check_error(self): - self._get('/test/api/rgw/status') + self._get('/test/ui-api/rgw/status') self.assertStatus(200) self.assertJsonBody({'available': False, 'message': 'My test error'}) @@ -36,7 +36,7 @@ class RgwControllerTestCase(ControllerTestCase): @patch.object(RgwClient, '_get_user_id', Mock(return_value='fake-user')) @patch.object(RgwClient, 'is_service_online', Mock(return_value=False)) def test_status_not_online(self): - self._get('/test/api/rgw/status') + self._get('/test/ui-api/rgw/status') self.assertStatus(200) self.assertJsonBody({'available': False, 'message': "Failed to connect to the Object Gateway's Admin Ops API."}) @@ -45,14 +45,14 @@ class RgwControllerTestCase(ControllerTestCase): @patch.object(RgwClient, 'is_service_online', Mock(return_value=True)) @patch.object(RgwClient, '_is_system_user', Mock(return_value=False)) def test_status_not_system_user(self): - self._get('/test/api/rgw/status') + self._get('/test/ui-api/rgw/status') self.assertStatus(200) self.assertJsonBody({'available': False, 'message': 'The system flag is not set for user "fake-user".'}) def test_status_no_service(self): RgwStub.get_mgr_no_services() - self._get('/test/api/rgw/status') + self._get('/test/ui-api/rgw/status') self.assertStatus(200) self.assertJsonBody({'available': False, 'message': 'No RGW service is running.'})