]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/spdk/scripts/rpc/nvmf.py
import 15.2.0 Octopus source
[ceph.git] / ceph / src / spdk / scripts / rpc / nvmf.py
index d805ebca8f19bd729fde17c5a90879d373e65c35..7f0cebcad96d2bfc52f811aed6a6283a3c4be443 100644 (file)
@@ -1,40 +1,17 @@
-
-
-def set_nvmf_target_options(client,
-                            max_queue_depth=None,
-                            max_qpairs_per_ctrlr=None,
-                            in_capsule_data_size=None,
-                            max_io_size=None,
-                            max_subsystems=None,
-                            io_unit_size=None):
+def set_nvmf_target_max_subsystems(client,
+                                   max_subsystems=None):
     """Set NVMe-oF target options.
 
     Args:
-        max_queue_depth: Max number of outstanding I/O per queue (optional)
-        max_qpairs_per_ctrlr: Max number of SQ and CQ per controller (optional)
-        in_capsule_data_size: Maximum in-capsule data size in bytes (optional)
-        max_io_size: Maximum I/O data size in bytes (optional)
-        max_subsystems: Maximum number of NVMe-oF subsystems (optional)
-        io_unit_size: I/O unit size in bytes (optional)
+        max_subsystems: Maximum number of NVMe-oF subsystems (e.g. 1024)
 
     Returns:
         True or False
     """
     params = {}
 
-    if max_queue_depth:
-        params['max_queue_depth'] = max_queue_depth
-    if max_qpairs_per_ctrlr:
-        params['max_qpairs_per_ctrlr'] = max_qpairs_per_ctrlr
-    if in_capsule_data_size:
-        params['in_capsule_data_size'] = in_capsule_data_size
-    if max_io_size:
-        params['max_io_size'] = max_io_size
-    if max_subsystems:
-        params['max_subsystems'] = max_subsystems
-    if io_unit_size:
-        params['io_unit_size'] = io_unit_size
-    return client.call('set_nvmf_target_options', params)
+    params['max_subsystems'] = max_subsystems
+    return client.call('set_nvmf_target_max_subsystems', params)
 
 
 def set_nvmf_target_config(client,
@@ -65,7 +42,11 @@ def nvmf_create_transport(client,
                           in_capsule_data_size=None,
                           max_io_size=None,
                           io_unit_size=None,
-                          max_aq_depth=None):
+                          max_aq_depth=None,
+                          num_shared_buffers=None,
+                          buf_cache_size=None,
+                          max_srq_depth=None,
+                          no_srq=False):
     """NVMf Transport Create options.
 
     Args:
@@ -76,6 +57,10 @@ def nvmf_create_transport(client,
         max_io_size: Maximum I/O data size in bytes (optional)
         io_unit_size: I/O unit size in bytes (optional)
         max_aq_depth: Max size admin quque per controller (optional)
+        num_shared_buffers: The number of pooled data buffers available to the transport (optional)
+        buf_cache_size: The number of shared buffers to reserve for each poll group (optional)
+        max_srq_depth: Max number of outstanding I/O per shared receive queue - RDMA specific (optional)
+        no_srq: Boolean flag to disable SRQ even for devices that support it - RDMA specific (optional)
 
     Returns:
         True or False
@@ -95,66 +80,39 @@ def nvmf_create_transport(client,
         params['io_unit_size'] = io_unit_size
     if max_aq_depth:
         params['max_aq_depth'] = max_aq_depth
+    if num_shared_buffers:
+        params['num_shared_buffers'] = num_shared_buffers
+    if buf_cache_size:
+        params['buf_cache_size'] = buf_cache_size
+    if max_srq_depth:
+        params['max_srq_depth'] = max_srq_depth
+    if no_srq:
+        params['no_srq'] = no_srq
     return client.call('nvmf_create_transport', params)
 
 
-def get_nvmf_subsystems(client):
-    """Get list of NVMe-oF subsystems.
+def get_nvmf_transports(client):
+    """Get list of NVMe-oF transports.
 
     Returns:
-        List of NVMe-oF subsystem objects.
+        List of NVMe-oF transport objects.
     """
-    return client.call('get_nvmf_subsystems')
+    return client.call('get_nvmf_transports')
 
 
-def construct_nvmf_subsystem(client,
-                             nqn,
-                             serial_number,
-                             listen_addresses=None,
-                             hosts=None,
-                             allow_any_host=False,
-                             namespaces=None,
-                             max_namespaces=0):
-    """Construct an NVMe over Fabrics target subsystem.
-
-    Args:
-        nqn: Subsystem NQN.
-        serial_number: Serial number of virtual controller.
-        listen_addresses: Array of listen_address objects (optional).
-        hosts: Array of strings containing allowed host NQNs (optional). Default: No hosts allowed.
-        allow_any_host: Allow any host (True) or enforce allowed host whitelist (False). Default: False.
-        namespaces: Array of namespace objects (optional). Default: No namespaces.
-        max_namespaces: Maximum number of namespaces that can be attached to the subsystem (optional). Default: 0 (Unlimited).
+def get_nvmf_subsystems(client):
+    """Get list of NVMe-oF subsystems.
 
     Returns:
-        True or False
+        List of NVMe-oF subsystem objects.
     """
-    params = {
-        'nqn': nqn,
-        'serial_number': serial_number,
-    }
-
-    if max_namespaces:
-        params['max_namespaces'] = max_namespaces
-
-    if listen_addresses:
-        params['listen_addresses'] = listen_addresses
-
-    if hosts:
-        params['hosts'] = hosts
-
-    if allow_any_host:
-        params['allow_any_host'] = True
-
-    if namespaces:
-        params['namespaces'] = namespaces
-
-    return client.call('construct_nvmf_subsystem', params)
+    return client.call('get_nvmf_subsystems')
 
 
 def nvmf_subsystem_create(client,
                           nqn,
                           serial_number,
+                          model_number='SPDK bdev Controller',
                           allow_any_host=False,
                           max_namespaces=0):
     """Construct an NVMe over Fabrics target subsystem.
@@ -162,6 +120,7 @@ def nvmf_subsystem_create(client,
     Args:
         nqn: Subsystem NQN.
         serial_number: Serial number of virtual controller.
+        model_number: Model number of virtual controller.
         allow_any_host: Allow any host (True) or enforce allowed host whitelist (False). Default: False.
         max_namespaces: Maximum number of namespaces that can be attached to the subsystem (optional). Default: 0 (Unlimited).
 
@@ -175,6 +134,9 @@ def nvmf_subsystem_create(client,
     if serial_number:
         params['serial_number'] = serial_number
 
+    if model_number:
+        params['model_number'] = model_number
+
     if allow_any_host:
         params['allow_any_host'] = True