]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: fetch all namespaces in a gateway group 67101/head
authorAfreen Misbah <afreen@ibm.com>
Wed, 28 Jan 2026 09:59:08 +0000 (15:29 +0530)
committerAfreen Misbah <afreen@ibm.com>
Fri, 30 Jan 2026 07:44:31 +0000 (13:14 +0530)
- 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 <afreen@ibm.com>
src/pybind/mgr/dashboard/controllers/nvmeof.py
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-namespaces-list/nvmeof-namespaces-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/nvmeof.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/nvmeof.service.ts
src/pybind/mgr/dashboard/openapi.yaml

index 66d915bb29e7908ff5a79d52adb863e6e1c2a258..8e28d19c8c9b8c37ccb79475ca021eb53a2ad987 100644 (file)
@@ -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):
index 2771725d5830a37b44f565984017e1899adbc915..39f1cdc91a7949feff058e9c54054b1d81160c99 100644 (file)
@@ -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() {
index ccecea5f0205db9aad076796b4a767e57465ed67..0bbbc371066a32883b64e870ad72fc64ccb7e6e9 100755 (executable)
@@ -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', () => {
index 0fd598e5f53b189dafc7526185ec4c8d6e24bdbf..aaccc68e14c17b13ffc6c30ea2ca9e5c22053fa5 100644 (file)
@@ -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) {
index 379247a10006c526bd05244cc14a86c824c1f83c..1d7ca7cd51b9d945494300091807ac466c0e2edd 100755 (executable)
@@ -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: