Commit e39760fd authored by Krzysztof Smolinski's avatar Krzysztof Smolinski Committed by Tomasz Zawadzki
Browse files

rpc/bdev_raid_create: added superblock parameter



Introduction of superblock parameter for bdev_raid_create rpc. This
parameter determines whether raid bdev should be created with support
for on-disk metadata (support for raid on-disk metadata is going to be
implemented in the future).

Change-Id: Ie8c64f837dd7eb3ba788b7c5d7bc98e8f1368ba7
Signed-off-by: default avatarKrzysztof Smolinski <krzysztof.smolinski@intel.com>
Signed-off-by: default avatarArtur Paszkiewicz <artur.paszkiewicz@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15245


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
parent b9792a95
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -10393,6 +10393,7 @@ strip_size_kb | Required | number | Strip size in KB
raid_level              | Required | string      | RAID level
base_bdevs              | Required | string      | Base bdevs name, whitespace separated list in quotes
uuid                    | Optional | string      | UUID for this RAID bdev
superblock              | Optional | boolean     | If set, information about raid bdev will be stored in superblock on each base bdev (default: `false`)

#### Example

+4 −0
Original line number Diff line number Diff line
@@ -130,6 +130,9 @@ struct rpc_bdev_raid_create {

	/* UUID for this raid bdev */
	struct spdk_uuid		     uuid;

	/* If set, information about raid bdev will be stored in superblock on each base bdev */
	bool                                 superblock_enabled;
};

/*
@@ -195,6 +198,7 @@ static const struct spdk_json_object_decoder rpc_bdev_raid_create_decoders[] = {
	{"raid_level", offsetof(struct rpc_bdev_raid_create, level), decode_raid_level},
	{"base_bdevs", offsetof(struct rpc_bdev_raid_create, base_bdevs), decode_base_bdevs},
	{"uuid", offsetof(struct rpc_bdev_raid_create, uuid), spdk_json_decode_uuid, true},
	{"superblock", offsetof(struct rpc_bdev_raid_create, superblock_enabled), spdk_json_decode_bool, true},
};

/*
+4 −2
Original line number Diff line number Diff line
@@ -402,7 +402,7 @@ def bdev_raid_get_bdevs(client, category):
    return client.call('bdev_raid_get_bdevs', params)


def bdev_raid_create(client, name, raid_level, base_bdevs, strip_size=None, strip_size_kb=None, uuid=None):
def bdev_raid_create(client, name, raid_level, base_bdevs, strip_size=None, strip_size_kb=None, uuid=None, superblock=False):
    """Create raid bdev. Either strip size arg will work but one is required.

    Args:
@@ -412,11 +412,13 @@ def bdev_raid_create(client, name, raid_level, base_bdevs, strip_size=None, stri
        raid_level: raid level of raid bdev, supported values 0
        base_bdevs: Space separated names of Nvme bdevs in double quotes, like "Nvme0n1 Nvme1n1 Nvme2n1"
        uuid: UUID for this raid bdev (optional)
        superblock: information about raid bdev will be stored in superblock on each base bdev,
                    disabled by default due to backward compatibility

    Returns:
        None
    """
    params = {'name': name, 'raid_level': raid_level, 'base_bdevs': base_bdevs}
    params = {'name': name, 'raid_level': raid_level, 'base_bdevs': base_bdevs, 'superblock': superblock}

    if strip_size:
        params['strip_size'] = strip_size
+4 −1
Original line number Diff line number Diff line
@@ -2130,13 +2130,16 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
                                  strip_size_kb=args.strip_size_kb,
                                  raid_level=args.raid_level,
                                  base_bdevs=base_bdevs,
                                  uuid=args.uuid)
                                  uuid=args.uuid,
                                  superblock=args.superblock)
    p = subparsers.add_parser('bdev_raid_create', help='Create new raid bdev')
    p.add_argument('-n', '--name', help='raid bdev name', required=True)
    p.add_argument('-z', '--strip-size-kb', help='strip size in KB', type=int)
    p.add_argument('-r', '--raid-level', help='raid level, raid0, raid1 and a special level concat are supported', required=True)
    p.add_argument('-b', '--base-bdevs', help='base bdevs name, whitespace separated list in quotes', required=True)
    p.add_argument('--uuid', help='UUID for this raid bdev', required=False)
    p.add_argument('-s', '--superblock', help='information about raid bdev will be stored in superblock on each base bdev, '
                                              'disabled by default due to backward compatibility', action='store_true')
    p.set_defaults(func=bdev_raid_create)

    def bdev_raid_delete(args):
+1 −0
Original line number Diff line number Diff line
@@ -98,6 +98,7 @@ DEFINE_STUB(spdk_json_decode_uuid, int, (const struct spdk_json_val *val, void *
DEFINE_STUB(spdk_json_decode_array, int, (const struct spdk_json_val *values,
		spdk_json_decode_fn decode_func,
		void *out, size_t max_size, size_t *out_size, size_t stride), 0);
DEFINE_STUB(spdk_json_decode_bool, int, (const struct spdk_json_val *val, void *out), 0);
DEFINE_STUB(spdk_json_write_name, int, (struct spdk_json_write_ctx *w, const char *name), 0);
DEFINE_STUB(spdk_json_write_object_begin, int, (struct spdk_json_write_ctx *w), 0);
DEFINE_STUB(spdk_json_write_named_object_begin, int, (struct spdk_json_write_ctx *w,