Commit d0c013a7 authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

bdev/rbd: add get_bdevs JSON dump function



Report the Ceph pool and RBD name in the get_bdevs output for RBD bdevs.

Change-Id: I0e9be0b540e90503ce052c968f979b5887673c24
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/373416


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 99f838a3
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@
#include "spdk/log.h"
#include "spdk/bdev.h"
#include "spdk/io_channel.h"
#include "spdk/json.h"
#include "spdk/string.h"

#include "spdk_internal/bdev.h"
@@ -455,11 +456,31 @@ bdev_rbd_get_io_channel(void *ctx)
	return spdk_get_io_channel(&rbd_bdev->info);
}

static int
bdev_rbd_dump_config_json(void *ctx, struct spdk_json_write_ctx *w)
{
	struct bdev_rbd *rbd_bdev = ctx;

	spdk_json_write_name(w, "rbd");
	spdk_json_write_object_begin(w);

	spdk_json_write_name(w, "pool_name");
	spdk_json_write_string(w, rbd_bdev->pool_name);

	spdk_json_write_name(w, "rbd_name");
	spdk_json_write_string(w, rbd_bdev->rbd_name);

	spdk_json_write_object_end(w);

	return 0;
}

static const struct spdk_bdev_fn_table rbd_fn_table = {
	.destruct		= bdev_rbd_destruct,
	.submit_request		= bdev_rbd_submit_request,
	.io_type_supported	= bdev_rbd_io_type_supported,
	.get_io_channel		= bdev_rbd_get_io_channel,
	.dump_config_json	= bdev_rbd_dump_config_json,
};

static void
+1 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ timing_exit start_iscsi_tgt
$rpc_py add_portal_group 1 $TARGET_IP:$PORT
$rpc_py add_initiator_group $INITIATOR_TAG $INITIATOR_NAME $NETMASK
$rpc_py construct_rbd_bdev $RBD_POOL $RBD_NAME 4096
$rpc_py get_bdevs
# "Ceph0:0" ==> use Ceph0 blockdev for LUN0
# "1:2" ==> map PortalGroup1 to InitiatorGroup2
# "64" ==> iSCSI queue depth 64