From: Afreen Misbah Date: Wed, 28 Jan 2026 09:59:08 +0000 (+0530) Subject: mgr/dashboard: fetch all namespaces in a gateway group X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F67101%2Fhead;p=ceph.git mgr/dashboard: fetch all namespaces in a gateway group - adds a new API /api/gateway_group/{group}/namespace - updates tests - needed for UI flows and in general to fetch all namespaces, could not change existing API due to the maintenence of backward compatibility - in a followup PR will add server side pagination Fixes https://tracker.ceph.com/issues/74622 Signed-off-by: Afreen Misbah --- diff --git a/src/pybind/mgr/dashboard/controllers/nvmeof.py b/src/pybind/mgr/dashboard/controllers/nvmeof.py index 66d915bb29e7..8e28d19c8c9b 100644 --- a/src/pybind/mgr/dashboard/controllers/nvmeof.py +++ b/src/pybind/mgr/dashboard/controllers/nvmeof.py @@ -474,6 +474,27 @@ else: ) ) + @APIRouter("/nvmeof/gateway_group/{gw_group}/namespace", Scope.NVME_OF) + @APIDoc("NVMe-oF Gateway Management API", "NVMe-oF Gateway") + class NVMeoFGatewayGroup(RESTController): + @Endpoint('GET') + @EndpointDoc( + "List all NVMeoF namespaces in a gateway group", + parameters={ + "gw_group": Param(str, "NVMeoF gateway group", True, None), + "server_address": Param(str, "NVMeoF gateway address", True, None), + }, + ) + @convert_to_model(model.NamespaceList) + @handle_nvmeof_error + def list(self, gw_group: str, server_address: Optional[str] = None): + return NVMeoFClient( + gw_group=gw_group, + server_address=server_address + ).stub.list_namespaces( + NVMeoFClient.pb2.list_namespaces_req() + ) + @APIRouter("/nvmeof/subsystem/{nqn}/namespace", Scope.NVME_OF) @APIDoc("NVMe-oF Subsystem Namespace Management API", "NVMe-oF Subsystem Namespace") class NVMeoFNamespace(RESTController): diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-namespaces-list/nvmeof-namespaces-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-namespaces-list/nvmeof-namespaces-list.component.ts index 2771725d5830..39f1cdc91a79 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-namespaces-list/nvmeof-namespaces-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-namespaces-list/nvmeof-namespaces-list.component.ts @@ -162,11 +162,9 @@ export class NvmeofNamespacesListComponent implements OnInit { } listNamespaces() { - this.nvmeofService - .listNamespaces(this.subsystemNQN, this.group) - .subscribe((res: NvmeofSubsystemNamespace[]) => { - this.namespaces = res; - }); + this.nvmeofService.listNamespaces(this.group).subscribe((res: NvmeofSubsystemNamespace[]) => { + this.namespaces = res; + }); } deleteNamespaceModal() { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nvmeof.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nvmeof.service.spec.ts index ccecea5f0205..0bbbc371066a 100755 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nvmeof.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nvmeof.service.spec.ts @@ -142,10 +142,8 @@ describe('NvmeofService', () => { describe('test namespace APIs', () => { const mockNsid = '1'; it('should call listNamespaces', () => { - service.listNamespaces(mockNQN, mockGroupName).subscribe(); - const req = httpTesting.expectOne( - `${API_PATH}/subsystem/${mockNQN}/namespace?gw_group=${mockGroupName}` - ); + service.listNamespaces(mockGroupName).subscribe(); + const req = httpTesting.expectOne(`${API_PATH}/gateway_group/${mockGroupName}/namespace`); expect(req.request.method).toBe('GET'); }); it('should call getNamespace', () => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nvmeof.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nvmeof.service.ts index 0fd598e5f53b..aaccc68e14c1 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nvmeof.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nvmeof.service.ts @@ -168,8 +168,8 @@ export class NvmeofService { } // Namespaces - listNamespaces(subsystemNQN: string, group: string) { - return this.http.get(`${API_PATH}/subsystem/${subsystemNQN}/namespace?gw_group=${group}`); + listNamespaces(group: string) { + return this.http.get(`${API_PATH}/gateway_group/${group}/namespace`); } getNamespace(subsystemNQN: string, nsid: string, group: string) { diff --git a/src/pybind/mgr/dashboard/openapi.yaml b/src/pybind/mgr/dashboard/openapi.yaml index 379247a10006..1d7ca7cd51b9 100755 --- a/src/pybind/mgr/dashboard/openapi.yaml +++ b/src/pybind/mgr/dashboard/openapi.yaml @@ -9721,6 +9721,76 @@ paths: summary: Get the version of the NVMeoF gateway tags: - NVMe-oF Gateway + /api/nvmeof/gateway_group/{gw_group}/namespace: + get: + parameters: + - description: NVMeoF gateway group + in: path + name: gw_group + required: true + schema: + type: string + - allowEmptyValue: true + description: NVMeoF gateway address + in: query + name: server_address + schema: + type: string + responses: + '200': + content: + application/vnd.ceph.api.v1.0+json: + 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: List all NVMeoF namespaces in a gateway group + tags: + - NVMe-oF Gateway + /api/nvmeof/gateway_group/{gw_group}/namespace/list: + get: + parameters: + - description: NVMeoF gateway group + in: path + name: gw_group + required: true + schema: + type: string + - allowEmptyValue: true + description: NVMeoF gateway address + in: query + name: server_address + schema: + type: string + responses: + '200': + content: + application/vnd.ceph.api.v1.0+json: + 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: List all NVMeoF namespaces in a gateway group + tags: + - NVMe-oF Gateway /api/nvmeof/spdk/log_level: get: parameters: