Commit 4722123b authored by Boris Glimcher's avatar Boris Glimcher Committed by Tomasz Zawadzki
Browse files

python/blobfs: align code to documentation



Change-Id: I844bd5d8225403520c5b9870cd6f366b57c0699e
Signed-off-by: default avatarBoris Glimcher <Boris.Glimcher@emc.com>
Reviewed-on: https://review.spdk.io/c/spdk/spdk/+/26179


Tested-by: default avatarSPDK Automated Test System <spdkbot@gmail.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz@tzawadzki.com>
Reviewed-by: default avatarKonrad Sztyber <ksztyber@nvidia.com>
parent 1c63d1df
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -12487,7 +12487,9 @@ Detect whether a blobfs exists on bdev.

#### Response

True if a blobfs exists on the bdev; False otherwise.
 Name   | Type    | Description
------- | ------- | ------------------------------------------------------
 result | boolean | True if a blobfs exists on the bdev; False otherwise.

#### Example

@@ -12603,7 +12605,9 @@ initialized or loaded filesystems are unloaded.

#### Response

True if cache size is set successfully; False if failed to set.
 Name   | Type    | Description
------- | ------- | ----------------------------------------------------------------
 result | boolean | True if cache size is set successfully; False if failed to set.

#### Example

+30 −22
Original line number Diff line number Diff line
@@ -7,14 +7,14 @@ def blobfs_detect(client, bdev_name):
    """Detect whether a blobfs exists on bdev.

    Args:
        bdev_name: block device name to detect blobfs
        bdev_name: Block device name to detect blobfs

    Returns:
        True if a blobfs exists on the bdev; False otherwise.
        result: True if a blobfs exists on the bdev; False otherwise.

    """
    params = {
        'bdev_name': bdev_name
    }
    params = dict()
    params['bdev_name'] = bdev_name
    return client.call('blobfs_detect', params)


@@ -22,41 +22,49 @@ def blobfs_create(client, bdev_name, cluster_sz=None):
    """Build blobfs on bdev.

    Args:
        bdev_name: block device name to build blobfs
        cluster_sz: Size of cluster in bytes (Optional). Must be multiple of 4KB page size. Default and minimal value is 1M.
        bdev_name: Block device name to create blobfs
        cluster_sz: Size of cluster in bytes. Must be multiple of 4KiB page size, default and minimal value is 1M.

    Returns:
        None
    """
    params = {
        'bdev_name': bdev_name
    }
    if cluster_sz:
    params = dict()
    params['bdev_name'] = bdev_name
    if cluster_sz is not None:
        params['cluster_sz'] = cluster_sz
    return client.call('blobfs_create', params)


def blobfs_mount(client, bdev_name, mountpoint):
    """Mount blobfs on bdev by FUSE.
    """Mount a blobfs on bdev to one host path through FUSE

    Args:
        bdev_name: block device name where the blobfs is
        bdev_name: Block device name where the blobfs is
        mountpoint: Mountpoint path in host to mount blobfs

    Returns:
        None
    """
    params = {
        'bdev_name': bdev_name,
        'mountpoint': mountpoint
    }
    params = dict()
    params['bdev_name'] = bdev_name
    params['mountpoint'] = mountpoint
    return client.call('blobfs_mount', params)


def blobfs_set_cache_size(client, size_in_mb):
    """Set cache size for the blobstore filesystem.
    """Set cache pool size for blobfs filesystems.

    This RPC is only permitted when the cache pool is not already initialized.
    The cache pool is initialized when the first blobfs filesystem is initialized or loaded.
    It is freed when the all initialized or loaded filesystems are unloaded.

    Args:
        size_in_mb: Cache size in megabytes

    Returns:
        True if cache size is set successfully; False if failed to set.
        result: True if cache size is set successfully; False if failed to set.

    """
    params = {
        'size_in_mb': size_in_mb
    }
    params = dict()
    params['size_in_mb'] = size_in_mb
    return client.call('blobfs_set_cache_size', params)