Commit ef804703 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Jim Harris
Browse files

bdev/raid: Add .INI config dump



Add dump the current configuration of raid bdevs to the specified
file for .INI config file.

.INI config file will be deprecated but this addition will be helpful
for now.

Change-Id: I35582ceaff18d81b066e3e63e0c8c22525ec6b9e
Signed-off-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/426299


Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarHailiang Wang <hailiangx.e.wang@intel.com>
Reviewed-by: default avatarPawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent ed6a63d5
Loading
Loading
Loading
Loading
+44 −1
Original line number Diff line number Diff line
@@ -1097,6 +1097,49 @@ raid_bdev_get_ctx_size(void)
	return sizeof(struct raid_bdev_io);
}

/*
 * brief:
 * raid_bdev_get_running_config is used to get the configuration options.
 *
 * params:
 * fp - The pointer to a file that will be written to the configuration options.
 * returns:
 * none
 */
static void
raid_bdev_get_running_config(FILE *fp)
{
	struct raid_bdev *raid_bdev;
	struct spdk_bdev *base;
	int index = 1;
	uint16_t i;

	TAILQ_FOREACH(raid_bdev, &g_spdk_raid_bdev_configured_list, state_link) {
		fprintf(fp,
			"\n"
			"[RAID%d]\n"
			"  Name %s\n"
			"  StripSize %" PRIu32 "\n"
			"  NumDevices %hu\n"
			"  RaidLevel %hhu\n",
			index, raid_bdev->bdev.name, raid_bdev->strip_size,
			raid_bdev->num_base_bdevs, raid_bdev->raid_level);
		fprintf(fp,
			"  Devices ");
		for (i = 0; i < raid_bdev->num_base_bdevs; i++) {
			base = raid_bdev->base_bdev_info[i].bdev;
			if (base) {
				fprintf(fp,
					"%s ",
					base->name);
			}
		}
		fprintf(fp,
			"\n");
		index++;
	}
}

/*
 * brief:
 * raid_bdev_can_claim_bdev is the function to check if this base_bdev can be
@@ -1143,7 +1186,7 @@ static struct spdk_bdev_module g_raid_if = {
	.module_fini = raid_bdev_exit,
	.get_ctx_size = raid_bdev_get_ctx_size,
	.examine_config = raid_bdev_examine,
	.config_text = NULL,
	.config_text = raid_bdev_get_running_config,
	.async_init = false,
	.async_fini = false,
};