]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: add traddr param to nvmeof cli/api endpoints 62732/head
authorTomer Haskalovitch <il033030@tomers-mbp.givatayim.il.ibm.com>
Mon, 7 Apr 2025 09:07:22 +0000 (12:07 +0300)
committerTomer Haskalovitch <il033030@Tomers-MBP.lan>
Fri, 11 Apr 2025 01:17:57 +0000 (04:17 +0300)
Signed-off-by: Tomer Haskalovitch <il033030@Tomers-MBP.lan>
src/pybind/mgr/dashboard/controllers/nvmeof.py
src/pybind/mgr/dashboard/openapi.yaml

index a22864442e32cec5ccac5fe0a04098daf1038eab..9498cc0557b818c06fd6041634d218fdd2da9c0f 100644 (file)
@@ -35,8 +35,8 @@ else:
         @NvmeofCLICommand("nvmeof gw info")
         @convert_to_model(model.GatewayInfo)
         @handle_nvmeof_error
-        def list(self, gw_group: Optional[str] = None):
-            return NVMeoFClient(gw_group=gw_group).stub.get_gateway_info(
+        def list(self, gw_group: Optional[str] = None, traddr: Optional[str] = None):
+            return NVMeoFClient(gw_group=gw_group, traddr=traddr).stub.get_gateway_info(
                 NVMeoFClient.pb2.get_gateway_info_req()
             )
 
@@ -58,8 +58,8 @@ else:
         @NvmeofCLICommand("nvmeof gw version")
         @convert_to_model(model.GatewayVersion)
         @handle_nvmeof_error
-        def version(self, gw_group: Optional[str] = None):
-            gw_info = NVMeoFClient(gw_group=gw_group).stub.get_gateway_info(
+        def version(self, gw_group: Optional[str] = None, traddr: Optional[str] = None):
+            gw_info = NVMeoFClient(gw_group=gw_group, traddr=traddr).stub.get_gateway_info(
                 NVMeoFClient.pb2.get_gateway_info_req()
             )
             return NVMeoFClient.pb2.gw_version(status=gw_info.status,
@@ -71,8 +71,9 @@ else:
         @NvmeofCLICommand("nvmeof gw get_log_level")
         @convert_to_model(model.GatewayLogLevelInfo)
         @handle_nvmeof_error
-        def get_log_level(self, gw_group: Optional[str] = None):
-            gw_log_level = NVMeoFClient(gw_group=gw_group).stub.get_gateway_log_level(
+        def get_log_level(self, gw_group: Optional[str] = None, traddr: Optional[str] = None):
+            gw_log_level = NVMeoFClient(gw_group=gw_group,
+                                        traddr=traddr).stub.get_gateway_log_level(
                 NVMeoFClient.pb2.get_gateway_log_level_req()
             )
             return gw_log_level
@@ -82,9 +83,11 @@ else:
         @NvmeofCLICommand("nvmeof gw set_log_level")
         @convert_to_model(model.RequestStatus)
         @handle_nvmeof_error
-        def set_log_level(self, log_level: str, gw_group: Optional[str] = None):
+        def set_log_level(self, log_level: str, gw_group: Optional[str] = None,
+                          traddr: Optional[str] = None):
             log_level = log_level.lower()
-            gw_log_level = NVMeoFClient(gw_group=gw_group).stub.set_gateway_log_level(
+            gw_log_level = NVMeoFClient(gw_group=gw_group,
+                                        traddr=traddr).stub.set_gateway_log_level(
                 NVMeoFClient.pb2.set_gateway_log_level_req(log_level=log_level)
             )
             return gw_log_level
@@ -97,8 +100,9 @@ else:
         @NvmeofCLICommand("nvmeof spdk_log_level get")
         @convert_to_model(model.SpdkNvmfLogFlagsAndLevelInfo)
         @handle_nvmeof_error
-        def get_spdk_log_level(self, gw_group: Optional[str] = None):
-            spdk_log_level = NVMeoFClient(gw_group=gw_group).stub.get_spdk_nvmf_log_flags_and_level(
+        def get_spdk_log_level(self, gw_group: Optional[str] = None, traddr: Optional[str] = None):
+            spdk_log_level = NVMeoFClient(gw_group=gw_group,
+                                          traddr=traddr).stub.get_spdk_nvmf_log_flags_and_level(
                 NVMeoFClient.pb2.get_spdk_nvmf_log_flags_and_level_req()
             )
             return spdk_log_level
@@ -109,10 +113,12 @@ else:
         @convert_to_model(model.RequestStatus)
         @handle_nvmeof_error
         def set_spdk_log_level(self, log_level: Optional[str] = None,
-                               print_level: Optional[str] = None, gw_group: Optional[str] = None):
+                               print_level: Optional[str] = None,
+                               gw_group: Optional[str] = None, traddr: Optional[str] = None):
             log_level = log_level.upper() if log_level else None
             print_level = print_level.upper() if print_level else None
-            spdk_log_level = NVMeoFClient(gw_group=gw_group).stub.set_gateway_log_level(
+            spdk_log_level = NVMeoFClient(gw_group=gw_group,
+                                          traddr=traddr).stub.set_gateway_log_level(
                 NVMeoFClient.pb2.set_spdk_nvmf_logs_req(log_level=log_level,
                                                         print_level=print_level)
             )
@@ -123,8 +129,10 @@ else:
         @NvmeofCLICommand("nvmeof spdk_log_level disable")
         @convert_to_model(model.RequestStatus)
         @handle_nvmeof_error
-        def disable_spdk_log_level(self, gw_group: Optional[str] = None):
-            spdk_log_level = NVMeoFClient(gw_group=gw_group).stub.disable_spdk_nvmf_logs(
+        def disable_spdk_log_level(self, gw_group: Optional[str] = None,
+                                   traddr: Optional[str] = None):
+            spdk_log_level = NVMeoFClient(gw_group=gw_group,
+                                          traddr=traddr).stub.disable_spdk_nvmf_logs(
                 NVMeoFClient.pb2.disable_spdk_nvmf_logs_req()
             )
             return spdk_log_level
@@ -137,8 +145,8 @@ else:
         @NvmeofCLICommand("nvmeof subsystem list")
         @convert_to_model(model.SubsystemList)
         @handle_nvmeof_error
-        def list(self, gw_group: Optional[str] = None):
-            return NVMeoFClient(gw_group=gw_group).stub.list_subsystems(
+        def list(self, gw_group: Optional[str] = None, traddr: Optional[str] = None):
+            return NVMeoFClient(gw_group=gw_group, traddr=traddr).stub.list_subsystems(
                 NVMeoFClient.pb2.list_subsystems_req()
             )
 
@@ -153,8 +161,8 @@ else:
         @NvmeofCLICommand("nvmeof subsystem get")
         @convert_to_model(model.SubsystemList)
         @handle_nvmeof_error
-        def get(self, nqn: str, gw_group: Optional[str] = None):
-            return NVMeoFClient(gw_group=gw_group).stub.list_subsystems(
+        def get(self, nqn: str, gw_group: Optional[str] = None, traddr: Optional[str] = None):
+            return NVMeoFClient(gw_group=gw_group, traddr=traddr).stub.list_subsystems(
                 NVMeoFClient.pb2.list_subsystems_req(subsystem_nqn=nqn)
             )
 
@@ -172,8 +180,8 @@ else:
         @convert_to_model(model.RequestStatus)
         @handle_nvmeof_error
         def create(self, nqn: str, enable_ha: bool = True, max_namespaces: int = 1024,
-                   gw_group: Optional[str] = None):
-            return NVMeoFClient(gw_group=gw_group).stub.create_subsystem(
+                   gw_group: Optional[str] = None, traddr: Optional[str] = None):
+            return NVMeoFClient(gw_group=gw_group, traddr=traddr).stub.create_subsystem(
                 NVMeoFClient.pb2.create_subsystem_req(
                     subsystem_nqn=nqn, max_namespaces=max_namespaces, enable_ha=enable_ha
                 )
@@ -191,8 +199,9 @@ else:
         @NvmeofCLICommand("nvmeof subsystem del")
         @convert_to_model(model.RequestStatus)
         @handle_nvmeof_error
-        def delete(self, nqn: str, force: Optional[str] = "false", gw_group: Optional[str] = None):
-            return NVMeoFClient(gw_group=gw_group).stub.delete_subsystem(
+        def delete(self, nqn: str, force: Optional[str] = "false", gw_group: Optional[str] = None,
+                   traddr: Optional[str] = None):
+            return NVMeoFClient(gw_group=gw_group, traddr=traddr).stub.delete_subsystem(
                 NVMeoFClient.pb2.delete_subsystem_req(
                     subsystem_nqn=nqn, force=str_to_bool(force)
                 )
@@ -212,8 +221,8 @@ else:
         @NvmeofCLICommand("nvmeof listener list")
         @convert_to_model(model.ListenerList)
         @handle_nvmeof_error
-        def list(self, nqn: str, gw_group: Optional[str] = None):
-            return NVMeoFClient(gw_group=gw_group).stub.list_listeners(
+        def list(self, nqn: str, gw_group: Optional[str] = None, traddr: Optional[str] = None):
+            return NVMeoFClient(gw_group=gw_group, traddr=traddr).stub.list_listeners(
                 NVMeoFClient.pb2.list_listeners_req(subsystem=nqn)
             )
 
@@ -301,8 +310,8 @@ else:
         @NvmeofCLICommand("nvmeof ns list")
         @convert_to_model(model.NamespaceList)
         @handle_nvmeof_error
-        def list(self, nqn: str, gw_group: Optional[str] = None):
-            return NVMeoFClient(gw_group=gw_group).stub.list_namespaces(
+        def list(self, nqn: str, gw_group: Optional[str] = None, traddr: Optional[str] = None):
+            return NVMeoFClient(gw_group=gw_group, traddr=traddr).stub.list_namespaces(
                 NVMeoFClient.pb2.list_namespaces_req(subsystem=nqn)
             )
 
@@ -318,8 +327,9 @@ else:
         @NvmeofCLICommand("nvmeof ns get")
         @convert_to_model(model.NamespaceList)
         @handle_nvmeof_error
-        def get(self, nqn: str, nsid: str, gw_group: Optional[str] = None):
-            return NVMeoFClient(gw_group=gw_group).stub.list_namespaces(
+        def get(self, nqn: str, nsid: str, gw_group: Optional[str] = None,
+                traddr: Optional[str] = None):
+            return NVMeoFClient(gw_group=gw_group, traddr=traddr).stub.list_namespaces(
                 NVMeoFClient.pb2.list_namespaces_req(subsystem=nqn, nsid=int(nsid))
             )
 
@@ -336,8 +346,9 @@ else:
         @NvmeofCLICommand("nvmeof ns get_io_stats")
         @convert_to_model(model.NamespaceIOStats)
         @handle_nvmeof_error
-        def io_stats(self, nqn: str, nsid: str, gw_group: Optional[str] = None):
-            return NVMeoFClient(gw_group=gw_group).stub.namespace_get_io_stats(
+        def io_stats(self, nqn: str, nsid: str, gw_group: Optional[str] = None,
+                     traddr: Optional[str] = None):
+            return NVMeoFClient(gw_group=gw_group, traddr=traddr).stub.namespace_get_io_stats(
                 NVMeoFClient.pb2.namespace_get_io_stats_req(
                     subsystem_nqn=nqn, nsid=int(nsid))
             )
@@ -380,10 +391,11 @@ else:
             block_size: int = 512,
             load_balancing_group: Optional[int] = None,
             gw_group: Optional[str] = None,
+            traddr: Optional[str] = None,
             force: Optional[bool] = False,
             no_auto_visible: Optional[bool] = False
         ):
-            return NVMeoFClient(gw_group=gw_group).stub.namespace_add(
+            return NVMeoFClient(gw_group=gw_group, traddr=traddr).stub.namespace_add(
                 NVMeoFClient.pb2.namespace_add_req(
                     subsystem_nqn=nqn,
                     rbd_image_name=rbd_image_name,
@@ -428,6 +440,7 @@ else:
             r_mbytes_per_second: Optional[int] = None,
             w_mbytes_per_second: Optional[int] = None,
             gw_group: Optional[str] = None,
+            traddr: Optional[str] = None,
             trash_image: Optional[bool] = None,
         ):
             contains_failure = False
@@ -436,7 +449,7 @@ else:
                 mib = 1024 * 1024
                 new_size_mib = int((rbd_image_size + mib - 1) / mib)
 
-                resp = NVMeoFClient(gw_group=gw_group).stub.namespace_resize(
+                resp = NVMeoFClient(gw_group=gw_group, traddr=traddr).stub.namespace_resize(
                     NVMeoFClient.pb2.namespace_resize_req(
                         subsystem_nqn=nqn, nsid=int(nsid), new_size=new_size_mib
                     )
@@ -482,7 +495,7 @@ else:
             if contains_failure:
                 cherrypy.response.status = 202
 
-            response = NVMeoFClient(gw_group=gw_group).stub.list_namespaces(
+            response = NVMeoFClient(gw_group=gw_group, traddr=traddr).stub.list_namespaces(
                 NVMeoFClient.pb2.list_namespaces_req(subsystem=nqn, nsid=int(nsid))
             )
             return response
@@ -505,9 +518,10 @@ else:
             nqn: str,
             nsid: str,
             gw_group: Optional[str] = None,
+            traddr: Optional[str] = None,
             force: Optional[str] = "false"
         ):
-            return NVMeoFClient(gw_group=gw_group).stub.namespace_delete(
+            return NVMeoFClient(gw_group=gw_group, traddr=traddr).stub.namespace_delete(
                 NVMeoFClient.pb2.namespace_delete_req(
                     subsystem_nqn=nqn,
                     nsid=int(nsid),
@@ -536,8 +550,8 @@ else:
             else o,
         )
         @handle_nvmeof_error
-        def list(self, nqn: str, gw_group: Optional[str] = None):
-            return NVMeoFClient(gw_group=gw_group).stub.list_hosts(
+        def list(self, nqn: str, gw_group: Optional[str] = None, traddr: Optional[str] = None):
+            return NVMeoFClient(gw_group=gw_group, traddr=traddr).stub.list_hosts(
                 NVMeoFClient.pb2.list_hosts_req(subsystem=nqn)
             )
 
@@ -553,8 +567,9 @@ else:
         @NvmeofCLICommand("nvmeof host add")
         @convert_to_model(model.RequestStatus)
         @handle_nvmeof_error
-        def create(self, nqn: str, host_nqn: str, gw_group: Optional[str] = None):
-            return NVMeoFClient(gw_group=gw_group).stub.add_host(
+        def create(self, nqn: str, host_nqn: str, gw_group: Optional[str] = None,
+                   traddr: Optional[str] = None):
+            return NVMeoFClient(gw_group=gw_group, traddr=traddr).stub.add_host(
                 NVMeoFClient.pb2.add_host_req(subsystem_nqn=nqn, host_nqn=host_nqn)
             )
 
@@ -570,8 +585,9 @@ else:
         @NvmeofCLICommand("nvmeof host del")
         @convert_to_model(model.RequestStatus)
         @handle_nvmeof_error
-        def delete(self, nqn: str, host_nqn: str, gw_group: Optional[str] = None):
-            return NVMeoFClient(gw_group=gw_group).stub.remove_host(
+        def delete(self, nqn: str, host_nqn: str, gw_group: Optional[str] = None,
+                   traddr: Optional[str] = None):
+            return NVMeoFClient(gw_group=gw_group, traddr=traddr).stub.remove_host(
                 NVMeoFClient.pb2.remove_host_req(subsystem_nqn=nqn, host_nqn=host_nqn)
             )
 
@@ -589,8 +605,8 @@ else:
         @NvmeofCLICommand("nvmeof connection list")
         @convert_to_model(model.ConnectionList)
         @handle_nvmeof_error
-        def list(self, nqn: str, gw_group: Optional[str] = None):
-            return NVMeoFClient(gw_group=gw_group).stub.list_connections(
+        def list(self, nqn: str, gw_group: Optional[str] = None, traddr: Optional[str] = None):
+            return NVMeoFClient(gw_group=gw_group, traddr=traddr).stub.list_connections(
                 NVMeoFClient.pb2.list_connections_req(subsystem=nqn)
             )
 
index c6e824b662a4fb31c5e5c9f5bc3d451b8d618279..df071682e26fecc35d0416df11cb91a492c5762a 100755 (executable)
@@ -8242,6 +8242,11 @@ paths:
         name: gw_group
         schema:
           type: string
+      - allowEmptyValue: true
+        in: query
+        name: traddr
+        schema:
+          type: string
       responses:
         '200':
           content:
@@ -8292,6 +8297,11 @@ paths:
         name: gw_group
         schema:
           type: string
+      - allowEmptyValue: true
+        in: query
+        name: traddr
+        schema:
+          type: string
       responses:
         '200':
           content:
@@ -8322,6 +8332,8 @@ paths:
                   type: string
                 log_level:
                   type: string
+                traddr:
+                  type: string
               required:
               - log_level
               type: object
@@ -8357,6 +8369,11 @@ paths:
         name: gw_group
         schema:
           type: string
+      - allowEmptyValue: true
+        in: query
+        name: traddr
+        schema:
+          type: string
       responses:
         '200':
           content:
@@ -8384,6 +8401,11 @@ paths:
         name: gw_group
         schema:
           type: string
+      - allowEmptyValue: true
+        in: query
+        name: traddr
+        schema:
+          type: string
       responses:
         '200':
           content:
@@ -8416,6 +8438,8 @@ paths:
                   type: string
                 print_level:
                   type: string
+                traddr:
+                  type: string
               type: object
       responses:
         '200':
@@ -8451,6 +8475,8 @@ paths:
               properties:
                 gw_group:
                   type: string
+                traddr:
+                  type: string
               type: object
       responses:
         '200':
@@ -8484,6 +8510,11 @@ paths:
         name: gw_group
         schema:
           type: string
+      - allowEmptyValue: true
+        in: query
+        name: traddr
+        schema:
+          type: string
       responses:
         '200':
           content:
@@ -8525,6 +8556,8 @@ paths:
                 nqn:
                   description: NVMeoF subsystem NQN
                   type: string
+                traddr:
+                  type: string
               required:
               - nqn
               type: object
@@ -8574,6 +8607,11 @@ paths:
         name: gw_group
         schema:
           type: string
+      - allowEmptyValue: true
+        in: query
+        name: traddr
+        schema:
+          type: string
       responses:
         '202':
           content:
@@ -8613,6 +8651,11 @@ paths:
         name: gw_group
         schema:
           type: string
+      - allowEmptyValue: true
+        in: query
+        name: traddr
+        schema:
+          type: string
       responses:
         '200':
           content:
@@ -8648,6 +8691,11 @@ paths:
         name: gw_group
         schema:
           type: string
+      - allowEmptyValue: true
+        in: query
+        name: traddr
+        schema:
+          type: string
       responses:
         '200':
           content:
@@ -8683,6 +8731,11 @@ paths:
         name: gw_group
         schema:
           type: string
+      - allowEmptyValue: true
+        in: query
+        name: traddr
+        schema:
+          type: string
       responses:
         '200':
           content:
@@ -8722,6 +8775,8 @@ paths:
                 host_nqn:
                   description: NVMeoF host NQN. Use "*" to allow any host.
                   type: string
+                traddr:
+                  type: string
               required:
               - host_nqn
               type: object
@@ -8771,6 +8826,11 @@ paths:
         name: gw_group
         schema:
           type: string
+      - allowEmptyValue: true
+        in: query
+        name: traddr
+        schema:
+          type: string
       responses:
         '202':
           content:
@@ -8811,6 +8871,11 @@ paths:
         name: gw_group
         schema:
           type: string
+      - allowEmptyValue: true
+        in: query
+        name: traddr
+        schema:
+          type: string
       responses:
         '200':
           content:
@@ -8974,6 +9039,11 @@ paths:
         name: gw_group
         schema:
           type: string
+      - allowEmptyValue: true
+        in: query
+        name: traddr
+        schema:
+          type: string
       responses:
         '200':
           content:
@@ -9044,6 +9114,8 @@ paths:
                   default: 1024
                   description: RBD image size
                   type: integer
+                traddr:
+                  type: string
                 trash_image:
                   default: false
                   description: Trash the RBD image when namespace is removed
@@ -9097,6 +9169,11 @@ paths:
         name: gw_group
         schema:
           type: string
+      - allowEmptyValue: true
+        in: query
+        name: traddr
+        schema:
+          type: string
       - default: 'false'
         description: Force remove the RBD image
         in: query
@@ -9148,6 +9225,11 @@ paths:
         name: gw_group
         schema:
           type: string
+      - allowEmptyValue: true
+        in: query
+        name: traddr
+        schema:
+          type: string
       responses:
         '200':
           content:
@@ -9205,6 +9287,8 @@ paths:
                 rw_mbytes_per_second:
                   description: Read/Write MB/s
                   type: integer
+                traddr:
+                  type: string
                 trash_image:
                   description: Trash RBD image after removing namespace
                   type: boolean
@@ -9253,6 +9337,11 @@ paths:
         name: gw_group
         schema:
           type: string
+      - allowEmptyValue: true
+        in: query
+        name: traddr
+        schema:
+          type: string
       responses:
         '200':
           content: