Commit c51db566 authored by Artur Paszkiewicz's avatar Artur Paszkiewicz Committed by Tomasz Zawadzki
Browse files

module/raid: show base bdev details in json



Change-Id: I0da3e91e7736bc651e284f68238ace864def87b2
Signed-off-by: default avatarArtur Paszkiewicz <artur.paszkiewicz@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16165


Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 9222ff97
Loading
Loading
Loading
Loading
+28 −4
Original line number Diff line number Diff line
@@ -10454,8 +10454,20 @@ Example response:
      "num_base_bdevs": 2,
      "num_base_bdevs_discovered": 2,
      "base_bdevs_list": [
        "malloc0",
        "malloc1"
        {
          "name": "malloc0",
          "uuid": "d2788884-5b3e-4fd7-87ff-6c78177e14ab",
          "is_configured": true,
          "data_offset": 256,
          "data_size": 261888
        },
        {
          "name": "malloc1",
          "uuid": "a81bb1f8-5865-488a-8758-10152017e7d1",
          "is_configured": true,
          "data_offset": 256,
          "data_size": 261888
        }
      ]
    },
    {
@@ -10467,8 +10479,20 @@ Example response:
      "num_base_bdevs": 2,
      "num_base_bdevs_discovered": 1,
      "base_bdevs_list": [
        "malloc2",
        null
        {
          "name": "malloc2",
          "uuid": "f60c20e1-3439-4f89-ae55-965a70333f86",
          "is_configured": true,
          "data_offset": 256,
          "data_size": 261888
        }
        {
          "name": "malloc3",
          "uuid": "00000000-0000-0000-0000-000000000000",
          "is_configured": false,
          "data_offset": 0,
          "data_size": 0
        }
      ]
    }
  ]
+10 −2
Original line number Diff line number Diff line
@@ -620,11 +620,19 @@ raid_bdev_write_info_json(struct raid_bdev *raid_bdev, struct spdk_json_write_ct
	spdk_json_write_name(w, "base_bdevs_list");
	spdk_json_write_array_begin(w);
	RAID_FOR_EACH_BASE_BDEV(raid_bdev, base_info) {
		if (base_info->desc) {
			spdk_json_write_string(w, spdk_bdev_desc_get_bdev(base_info->desc)->name);
		spdk_json_write_object_begin(w);
		spdk_json_write_name(w, "name");
		if (base_info->name) {
			spdk_json_write_string(w, base_info->name);
		} else {
			spdk_json_write_null(w);
		}
		spdk_uuid_fmt_lower(uuid_str, sizeof(uuid_str), &base_info->uuid);
		spdk_json_write_named_string(w, "uuid", uuid_str);
		spdk_json_write_named_bool(w, "is_configured", base_info->is_configured);
		spdk_json_write_named_uint64(w, "data_offset", base_info->data_offset);
		spdk_json_write_named_uint64(w, "data_size", base_info->data_size);
		spdk_json_write_object_end(w);
	}
	spdk_json_write_array_end(w);
}
+2 −2
Original line number Diff line number Diff line
@@ -160,14 +160,14 @@ function verify_raid_bdev_state() (
		return 1
	fi

	num_base_bdevs=$(echo $raid_bdev_info | jq -r '.base_bdevs_list | length')
	num_base_bdevs=$(echo $raid_bdev_info | jq -r '[.base_bdevs_list[]] | length')
	tmp=$(echo $raid_bdev_info | jq -r '.num_base_bdevs')
	if [ "$num_base_bdevs" != "$tmp" ]; then
		echo "incorrect num_base_bdevs: $tmp, expected: $num_base_bdevs"
		return 1
	fi

	num_base_bdevs_discovered=$(echo $raid_bdev_info | jq -r '[.base_bdevs_list[] | strings] | length')
	num_base_bdevs_discovered=$(echo $raid_bdev_info | jq -r '[.base_bdevs_list[] | select(.is_configured)] | length')
	tmp=$(echo $raid_bdev_info | jq -r '.num_base_bdevs_discovered')
	if [ "$num_base_bdevs_discovered" != "$tmp" ]; then
		echo "incorrect num_base_bdevs_discovered: $tmp, expected: $num_base_bdevs_discovered"
+2 −0
Original line number Diff line number Diff line
@@ -111,6 +111,8 @@ DEFINE_STUB(spdk_json_write_named_array_begin, int, (struct spdk_json_write_ctx
		const char *name), 0);
DEFINE_STUB(spdk_json_write_bool, int, (struct spdk_json_write_ctx *w, bool val), 0);
DEFINE_STUB(spdk_json_write_null, int, (struct spdk_json_write_ctx *w), 0);
DEFINE_STUB(spdk_json_write_named_uint64, int, (struct spdk_json_write_ctx *w, const char *name,
		uint64_t val), 0);
DEFINE_STUB(spdk_strerror, const char *, (int errnum), NULL);
DEFINE_STUB(spdk_bdev_queue_io_wait, int, (struct spdk_bdev *bdev, struct spdk_io_channel *ch,
		struct spdk_bdev_io_wait_entry *entry), 0);