]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: fetch all namespaces in a gateway group
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 15:25:52 +0000 (20:55 +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>
(cherry picked from commit b8fef80b1d36476c4aabed6b2d5c8f8353cee489)

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 27479c40aa1320672606aa6eb3ca51057120075a..cb5d48e06109a7e1c5a553963f521e26f9293aaa 100644 (file)
@@ -407,6 +407,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 0caa018c8bfe23043a204524f5683110ff79b8cb..a8ef90b7642511543c84fd9e08c3e440162cb493 100644 (file)
@@ -161,11 +161,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 af69d001a77d540cad0eda4368ad385cab933a12..1420841a6efb5ed0536c9ff9ddd47559f0109e25 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 55cabcfdf677ebabf8fad3e7f63d9fa68b4c38ce..9f29d924d512f044e0d970271c0a7f688df0aade 100755 (executable)
@@ -9402,6 +9402,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: