Commit 7b2e6213 authored by Eugene Kobyak's avatar Eugene Kobyak Committed by Tomasz Zawadzki
Browse files

python/rpc: Align parameters with C decoders



Adjust the types of parameters and add any missing ones
along with their descriptions in bdev.py and jsonrpc.md.

Change-Id: I3dfdc43cd4efe80eab02fe3653e5c636e2eb1497
Signed-off-by: default avatarEugene Kobyak <eugene.kobyak@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/23068


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarKrzysztof Karas <krzysztof.karas@intel.com>
parent f1fabd08
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -2884,7 +2884,7 @@ Get a list of compressed volumes that are missing their pmem metadata.

Name                    | Optional | Type        | Description
----------------------- | -------- | ----------- | -----------
name                    | Required | string      | Name of the compress bdev
name                    | Optional | string      | Name of the compress bdev

#### Example

@@ -2926,7 +2926,6 @@ key | Optional | string | Key in hex form. Obsolete, se
cipher                  | Optional | string      | Cipher to use, AES_CBC or AES_XTS (QAT and MLX5). Obsolete, see accel_crypto_key_create
key2                    | Optional | string      | 2nd key in hex form only required for cipher AET_XTS. Obsolete, see accel_crypto_key_create
key_name                | Optional | string      | Name of the key created with accel_crypto_key_create
module                  | Optional | string      | Name of the accel module which is used to create a key (if no key_name specified)

Both key and key2 must be passed in the hexlified form. For example, 256bit AES key may look like this:
afd9477abf50254219ccb75965fbe39f23ebead5676e292582a0a67f66b88215
@@ -3583,6 +3582,7 @@ md_size | Optional | number | Metadata size for this bdev (
md_interleave           | Optional | boolean     | Metadata location, interleaved if true, and separated if false. Default is false.
dif_type                | Optional | number      | Protection information type. Parameter --md-size needs to be set along --dif-type. Default=0 - no protection.
dif_is_head_of_md       | Optional | boolean     | Protection information is in the first 8 bytes of metadata. Default=false.
physical_block_size     | Optional | number      | Physical block size of device; must be a power of 2 and at least 512

#### Result

@@ -3660,7 +3660,7 @@ Construct @ref bdev_config_null

Name                    | Optional | Type        | Description
----------------------- | -------- | ----------- | -----------
name                    | Optional | string      | Bdev name to use
name                    | Required | string      | Bdev name to use
block_size              | Required | number      | Block size in bytes
num_blocks              | Required | number      | Number of blocks
uuid                    | Optional | string      | UUID of new bdev
@@ -3786,6 +3786,8 @@ Name | Optional | Type | Description
name                    | Required | string      | Bdev name to use
filename                | Required | number      | Path to device or file
block_size              | Optional | number      | Block size in bytes
readonly                | Optional | boolean     | set aio bdev as read-only
fallocate               | Optional | boolean     | Enable UNMAP and WRITE ZEROES support. Intended only for testing purposes due to synchronous syscall.

#### Result

@@ -4040,6 +4042,7 @@ trtype | Required | string | NVMe-oF target trtype: rdm
traddr                     | Required | string      | NVMe-oF target address: ip or BDF
adrfam                     | Optional | string      | NVMe-oF target adrfam: ipv4, ipv6, ib, fc, intra_host
trsvcid                    | Optional | string      | NVMe-oF target trsvcid: port number
priority                   | Optional | string      | Transport connection priority. Supported by TCP transport with POSIX sock module (see socket(7) man page).
subnqn                     | Optional | string      | NVMe-oF target subnqn
hostnqn                    | Optional | string      | NVMe-oF target hostnqn
hostaddr                   | Optional | string      | NVMe-oF host address: ip address
@@ -5042,11 +5045,12 @@ This method is available only if SPDK was build with Ceph RBD support.

Name                    | Optional | Type        | Description
----------------------- | -------- | ----------- | -----------
name                    | Required | string      | Registered Rados cluster object name
name                    | Optional | string      | Registered Rados cluster object name
user_id                 | Optional | string      | Ceph ID (i.e. admin, not client.admin)
config_param            | Optional | string map  | Explicit librados configuration
config_file             | Optional | string      | File path of libraodos configuration file
key_file                | Optional | string      | File path of libraodos key file
config_file             | Optional | string      | File path of librados configuration file
key_file                | Optional | string      | File path of librados key file
core_mask               | Optional | string      | Core mask for librados IO context threads

This RPC registers a Rados Cluster object handle which is only known
to rbd module, it uses user_id + config_param or user_id + config_file +
@@ -5380,6 +5384,7 @@ avg_read_latency | Required | number | average read latency (us)
p99_read_latency        | Required | number      | p99 read latency (us)
avg_write_latency       | Required | number      | average write latency (us)
p99_write_latency       | Required | number      | p99 write latency (us)
uuid                    | Optional | string      | UUID of new bdev

#### Result

@@ -5748,6 +5753,7 @@ uuid | Optional | string | UUID of restored bdev (not ap
core_mask               | Optional | string      | CPU core(s) possible for placement of the ftl core thread, application main thread by default
overprovisioning        | Optional | int         | Percentage of base device used for relocation, 20% by default
fast_shutdown           | Optional | bool        | When set FTL will minimize persisted data on target application shutdown and rely on shared memory during next load
l2p_dram_limit          | Optional | int         | DRAM limit for most recent L2P addresses (default 2048 MiB)

#### Result

@@ -5803,6 +5809,7 @@ uuid | Required | string | UUID of restored bdev
core_mask               | Optional | string      | CPU core(s) possible for placement of the ftl core thread, application main thread by default
overprovisioning        | Optional | int         | Percentage of base device used for relocation, 20% by default
fast_shutdown           | Optional | bool        | When set FTL will minimize persisted data on target application shutdown and rely on shared memory during next load
l2p_dram_limit          | Optional | int         | DRAM limit for most recent L2P addresses (default 2048 MiB)

#### Result

+36 −24
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ def bdev_wait_for_examine(client):
    return client.call('bdev_wait_for_examine')


def bdev_compress_create(client, base_bdev_name, pm_path, lb_size):
def bdev_compress_create(client, base_bdev_name, pm_path, lb_size=None):
    """Construct a compress virtual block device.

    Args:
@@ -135,7 +135,7 @@ def bdev_crypto_delete(client, name):
    return client.call('bdev_crypto_delete', params)


def bdev_ocf_create(client, name, mode, cache_line_size, cache_bdev_name, core_bdev_name):
def bdev_ocf_create(client, name, mode, cache_bdev_name, core_bdev_name, cache_line_size=None):
    """Add an OCF block device

    Args:
@@ -210,7 +210,7 @@ def bdev_ocf_get_bdevs(client, name=None):
    Returns:
        Array of OCF devices with their current status
    """
    params = None
    params = {}
    if name:
        params = {'name': name}
    return client.call('bdev_ocf_get_bdevs', params)
@@ -234,7 +234,7 @@ def bdev_ocf_set_cache_mode(client, name, mode):
    return client.call('bdev_ocf_set_cache_mode', params)


def bdev_ocf_set_seqcutoff(client, name, policy, threshold, promotion_count):
def bdev_ocf_set_seqcutoff(client, name, policy, threshold=None, promotion_count=None):
    """Set sequential cutoff parameters on all cores for the given OCF cache device

    Args:
@@ -950,7 +950,7 @@ def bdev_nvme_detach_controller(client, name, trtype=None, traddr=None,
    return client.call('bdev_nvme_detach_controller', params)


def bdev_nvme_reset_controller(client, name, cntlid):
def bdev_nvme_reset_controller(client, name, cntlid=None):
    """Reset an NVMe controller or all NVMe controllers in an NVMe bdev controller.

    Args:
@@ -966,7 +966,7 @@ def bdev_nvme_reset_controller(client, name, cntlid):
    return client.call('bdev_nvme_reset_controller', params)


def bdev_nvme_enable_controller(client, name, cntlid):
def bdev_nvme_enable_controller(client, name, cntlid=None):
    """Enable an NVMe controller or all NVMe controllers in an NVMe bdev controller.

    Args:
@@ -982,7 +982,7 @@ def bdev_nvme_enable_controller(client, name, cntlid):
    return client.call('bdev_nvme_enable_controller', params)


def bdev_nvme_disable_controller(client, name, cntlid):
def bdev_nvme_disable_controller(client, name, cntlid=None):
    """Disable an NVMe controller or all NVMe controllers in an NVMe bdev controller.

    Args:
@@ -1076,7 +1076,7 @@ def bdev_nvme_get_discovery_info(client):
    return client.call('bdev_nvme_get_discovery_info')


def bdev_nvme_get_io_paths(client, name):
def bdev_nvme_get_io_paths(client, name=None):
    """Display all or the specified NVMe bdev's active I/O paths

    Args:
@@ -1105,7 +1105,7 @@ def bdev_nvme_set_preferred_path(client, name, cntlid):
    return client.call('bdev_nvme_set_preferred_path', params)


def bdev_nvme_set_multipath_policy(client, name, policy, selector, rr_min_io):
def bdev_nvme_set_multipath_policy(client, name, policy, selector=None, rr_min_io=None):
    """Set multipath policy of the NVMe bdev

    Args:
@@ -1191,7 +1191,7 @@ def bdev_zone_block_delete(client, name):
    return client.call('bdev_zone_block_delete', params)


def bdev_rbd_register_cluster(client, name, user_id=None, config_param=None, config_file=None, key_file=None, core_mask=None):
def bdev_rbd_register_cluster(client, name=None, user_id=None, config_param=None, config_file=None, key_file=None, core_mask=None):
    """Create a Rados Cluster object of the Ceph RBD backend.

    Args:
@@ -1205,8 +1205,9 @@ def bdev_rbd_register_cluster(client, name, user_id=None, config_param=None, con
    Returns:
        Name of registered Rados Cluster object.
    """
    params = {'name': name}

    params = {}
    if name is not None:
        params['name'] = name
    if user_id is not None:
        params['user_id'] = user_id
    if config_param is not None:
@@ -1231,7 +1232,7 @@ def bdev_rbd_unregister_cluster(client, name):
    return client.call('bdev_rbd_unregister_cluster', params)


def bdev_rbd_get_clusters_info(client, name):
def bdev_rbd_get_clusters_info(client, name=None):
    """Get the cluster(s) info

    Args:
@@ -1388,7 +1389,7 @@ def bdev_error_delete(client, name):
    return client.call('bdev_error_delete', params)


def bdev_iscsi_set_options(client, timeout_sec):
def bdev_iscsi_set_options(client, timeout_sec=None):
    """Set options for the bdev iscsi.

    Args:
@@ -1592,16 +1593,18 @@ def bdev_split_delete(client, base_bdev):
    return client.call('bdev_split_delete', params)


def bdev_ftl_create(client, name, base_bdev, **kwargs):
def bdev_ftl_create(client, name, base_bdev, cache, **kwargs):
    """Construct FTL bdev

    Args:
        name: name of the bdev
        base_bdev: name of the base bdev
        cache: name of the cache device
        kwargs: optional parameters
    """
    params = {'name': name,
              'base_bdev': base_bdev}
              'base_bdev': base_bdev,
              'cache': cache}
    for key, value in kwargs.items():
        if value is not None:
            params[key] = value
@@ -1609,16 +1612,18 @@ def bdev_ftl_create(client, name, base_bdev, **kwargs):
    return client.call('bdev_ftl_create', params)


def bdev_ftl_load(client, name, base_bdev, **kwargs):
def bdev_ftl_load(client, name, base_bdev, cache, **kwargs):
    """Load FTL bdev

    Args:
        name: name of the bdev
        base_bdev: name of the base bdev
        cache: Name of the cache device
        kwargs: optional parameters
    """
    params = {'name': name,
              'base_bdev': base_bdev}
              'base_bdev': base_bdev,
              'cache': cache}
    for key, value in kwargs.items():
        if value is not None:
            params[key] = value
@@ -1626,26 +1631,32 @@ def bdev_ftl_load(client, name, base_bdev, **kwargs):
    return client.call('bdev_ftl_load', params)


def bdev_ftl_unload(client, name, fast_shutdown):
def bdev_ftl_unload(client, name, fast_shutdown=None):
    """Unload FTL bdev

    Args:
        name: name of the bdev
        fast_shutdown: When set FTL will minimize persisted data during deletion and rely on shared memory during next load
    """
    params = {'name': name,
              'fast_shutdown': fast_shutdown}
    params = {'name': name}

    if fast_shutdown is not None:
        params['fast_shutdown'] = fast_shutdown

    return client.call('bdev_ftl_unload', params)


def bdev_ftl_delete(client, name, fast_shutdown):
def bdev_ftl_delete(client, name, fast_shutdown=None):
    """Delete FTL bdev

    Args:
        name: name of the bdev
        fast_shutdown: When set FTL will minimize persisted data during deletion and rely on shared memory during next load
    """
    params = {'name': name,
              'fast_shutdown': fast_shutdown}
    params = {'name': name}

    if fast_shutdown is not None:
        params['fast_shutdown'] = fast_shutdown

    return client.call('bdev_ftl_delete', params)

@@ -1757,6 +1768,7 @@ def bdev_enable_histogram(client, name, enable):

    Args:
        bdev_name: name of bdev
        enable: Enable or disable histogram on specified device
    """
    params = {'name': name, "enable": enable}
    return client.call('bdev_enable_histogram', params)