From 390c216f84fd961bf1500d4935e569a1ebb8c051 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Fri, 23 Feb 2024 02:41:10 +0300 Subject: [PATCH] Rework & fix pool-create / pool-modify / pool-ls --- src/cli.cpp | 149 +++---- src/cli.h | 4 + src/cli_common.cpp | 26 -- src/cli_pool_cfg.cpp | 616 +++++++++----------------- src/cli_pool_cfg.h | 48 +- src/cli_pool_create.cpp | 198 +++------ src/cli_pool_ls.cpp | 904 +++++++++++++++++++------------------- src/cli_pool_modify.cpp | 215 +++------ src/cli_pool_rm.cpp | 18 +- src/etcd_state_client.cpp | 45 +- src/etcd_state_client.h | 7 +- src/str_util.cpp | 21 + src/str_util.h | 2 + 13 files changed, 885 insertions(+), 1368 deletions(-) diff --git a/src/cli.cpp b/src/cli.cpp index 79d86e67..afeb211c 100644 --- a/src/cli.cpp +++ b/src/cli.cpp @@ -113,104 +113,53 @@ static const char* help_text = " With --dry-run only checks if deletion is possible without data loss and\n" " redundancy degradation.\n" "\n" - "vitastor-cli create-pool --scheme -s --pg_minsize -n --parity_chunks [OPTIONS]\n" - " Create a pool.\n" - " --scheme \n" - " Redundancy scheme used for data in this pool. One of: \"replicated\", \"xor\", \"ec\" or \"jerasure\".\n" - " It's \"replicated\" by default.\n" - " --ec +\n" - " Shortcut for 'ec' scheme. scheme = ec, pg_size = N+K, parity_chunks = K.\n" - " -s|--pg_size \n" - " Total number of disks for PGs of this pool - i.e., number of replicas for replicated pools and number of data plus parity disks for EC/XOR pools.\n" - " --pg_minsize \n" - " Number of available live OSDs for PGs of this pool to remain active.\n" - " -n|--pg_count \n" - " Number of PGs for this pool.\n" - " --parity_chunks \n" - " Number of parity chunks for EC/XOR pools\n" - " -f|--force\n" - " Proceed without checking pool/OSD params (pg_size, block_size, bitmap_granularity, and immediate_commit).\n" - " --failure_domain \n" - " Failure domain specification. Must be \"host\" or \"osd\" or refer to one of the placement tree levels, defined in placement_levels.\n" - " --max_osd_combinations \n" - " This parameter specifies the maximum number of combinations to generate when optimising PG placement.\n" - " --block_size \n" - " Block size for this pool.\n" - " --bitmap_granularity \n" - " \"Sector\" size of virtual disks in this pool.\n" - " --immediate_commit \n" - " Immediate commit setting for this pool. One of \"all\", \"small\" and \"none\".\n" - " --pg_stripe_size \n" - " Specifies the stripe size for this pool according to which images are split into different PGs.\n" - " --root_node \n" - " Specifies the root node of the OSD tree to restrict this pool OSDs to.\n" - " --osd_tags \n" - " Specifies OSD tags to restrict this pool to.\n" - " Example: --osd_tags tag0 or --osd_tags tag0,tag1\n" - " --primary_affinity_tags \n" - " Specifies OSD tags to prefer putting primary OSDs in this pool to.\n" - " Example: --primary_affinity_tags tag0 or --primary_affinity_tags tag0,tag1\n" - " --scrub_interval \n" - " Automatic scrubbing interval for this pool. Format: number + unit s/m/h/d/M/y.\n" + "vitastor-cli create-pool|pool-create (-s |--ec +) -n [OPTIONS]\n" + " Create a pool. Required parameters:\n" + " -s|--pg_size R Number of replicas for replicated pools\n" + " --ec N+K Number of data (N) and parity (K) chunks for erasure-coded pools\n" + " -n|--pg_count N PG count for the new pool (start with 10*/pg_size rounded to a power of 2)\n" + " Optional parameters:\n" + " --pg_minsize R or N+K minus number of failures to tolerate without downtime\n" + " --failure_domain host Failure domain: host, osd or a level from placement_levels. Default: host\n" + " --root_node Put pool on child OSDs of this placement tree node\n" + " --osd_tags [,]... Put pool on OSDs tagged with all specified tags\n" + " --block_size 128k Put pool on OSDs with this data block size\n" + " --bitmap_granularity 4k Put pool on OSDs with this logical sector size\n" + " --immediate_commit none Put pool on OSDs with this or larger immediate_commit (none < small < all)\n" + " --primary_affinity_tags tags Prefer to put primary copies on OSDs with all specified tags\n" + " --scrub_interval