]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Add "gw refresh_network" cmd 69556/head
authorVallari Agrawal <vallari.agrawal@ibm.com>
Tue, 16 Jun 2026 14:38:29 +0000 (20:08 +0530)
committerVallari Agrawal <vallari.agrawal@ibm.com>
Thu, 18 Jun 2026 07:52:07 +0000 (13:22 +0530)
Fixes: https://tracker.ceph.com/issues/77442
Signed-off-by: Vallari Agrawal <vallari.agrawal@ibm.com>
src/pybind/mgr/dashboard/controllers/nvmeof.py
src/pybind/mgr/dashboard/model/nvmeof.py
src/pybind/mgr/dashboard/openapi.yaml

index 557ea546ef11299d20dd60c79849ba37532ae2ee..95065f361bda38b3374ac608a58709918c338dd3 100644 (file)
@@ -330,6 +330,43 @@ else:
                 NVMeoFClient.pb2.get_thread_stats_req()
             )
 
+        @UpdatePermission
+        @Endpoint('PUT', '/refresh_network')
+        @NvmeofCLICommand(
+            "nvmeof gateway refresh_network", model.GwRefreshNetworkStatus,
+            alias="nvmeof gw refresh_network",
+            success_message_template=("Refreshed configured network masks for subsystem "
+                                      "{nqn} on this gateway: Successful{added}{removed}"),
+            success_message_map={
+                "added": lambda v, _f: f"\nAdded: {', '.join(v)}" if v else "",
+                "removed": lambda v, _f: f"\nRemoved: {', '.join(v)}" if v else "",
+            }
+        )
+        @EndpointDoc(
+            "Re-evaluate subsystem network masks and update auto-listeners for this gateway",
+            parameters={
+                "nqn": Param(str, "NVMeoF subsystem NQN"),
+                "gw_group": Param(str, "NVMeoF gateway group", True, None),
+                "server_address": Param(str, "NVMeoF gateway address", True, None),
+                "traddr": Param(str, "NVMeoF gateway address (deprecated)", True, None),
+            },
+        )
+        @convert_to_model(model.GwRefreshNetworkStatus)
+        @handle_nvmeof_error
+        def refresh_network(self, nqn: str, gw_group: Optional[str] = None,
+                            server_address: Optional[str] = None,
+                            traddr: Optional[str] = None):
+            server_address = resolve_nvmeof_server_address(
+                server_address=server_address,
+                traddr=traddr
+            )
+            return NVMeoFClient(
+                gw_group=gw_group,
+                server_address=server_address
+            ).stub.gw_refresh_network(
+                NVMeoFClient.pb2.gw_refresh_network_req(subsystem_nqn=nqn)
+            )
+
     @APIRouter("/nvmeof/spdk", Scope.NVME_OF)
     @APIDoc("NVMe-oF SPDK Management API", "NVMe-oF SPDK")
     class NVMeoFSpdk(RESTController):
index f4b7327514e24c9ce8476a41ea0c14de50066a1f..ec703740042002329a985d085e2b06bd72c2ec86 100644 (file)
@@ -369,6 +369,13 @@ class RequestStatus(NamedTuple):
     error_message: str
 
 
+class GwRefreshNetworkStatus(NamedTuple):
+    status: int
+    error_message: str
+    added: List[str]
+    removed: List[str]
+
+
 class ListenAdress(NamedTuple):
     trtype: str
     adrfam: str
index 2ddd1190b47e51fd49eb4de01170e8bd513ee935..1bbd2efbee7683fbdfdbb309d065d0fa18c4516d 100644 (file)
@@ -12916,6 +12916,63 @@ paths:
       summary: Set NVMeoF gateway log levels
       tags:
       - NVMe-oF Gateway
+  /api/nvmeof/gateway/refresh_network:
+    put:
+      parameters: []
+      requestBody:
+        content:
+          application/json:
+            schema:
+              properties:
+                gw_group:
+                  description: NVMeoF gateway group
+                  type: string
+                nqn:
+                  description: NVMeoF subsystem NQN
+                  type: string
+                server_address:
+                  description: NVMeoF gateway address
+                  type: string
+                traddr:
+                  description: NVMeoF gateway address (deprecated)
+                  type: string
+              required:
+              - nqn
+              type: object
+      responses:
+        '200':
+          content:
+            application/json:
+              schema:
+                type: object
+            application/vnd.ceph.api.v1.0+json:
+              schema:
+                type: object
+          description: Resource updated.
+        '202':
+          content:
+            application/json:
+              schema:
+                type: object
+            application/vnd.ceph.api.v1.0+json:
+              schema:
+                type: object
+          description: Operation is still executing. Please check the task queue.
+        '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: Re-evaluate subsystem network masks and update auto-listeners for this
+        gateway
+      tags:
+      - NVMe-oF Gateway
   /api/nvmeof/gateway/stats:
     get:
       parameters: