forked from vitalif/vitastor
Compare commits
1 Commits
cli-ls-tre
...
cli-help-a
| Author | SHA1 | Date | |
|---|---|---|---|
| 9cd3db68b5 |
@@ -355,7 +355,7 @@ host stump
|
||||
|
||||
## ls-osd
|
||||
|
||||
`vitastor-cli osds|ls-osd|osd-ls [-l|--long]`
|
||||
`vitastor-cli osds|ls-osds|ls-osd|osd-ls [-l|--long]`
|
||||
|
||||
Show current OSDs as list, optionally with I/O statistics if -l is specified.
|
||||
|
||||
@@ -508,7 +508,7 @@ the Vitastor authorization model.
|
||||
|
||||
## modify-user
|
||||
|
||||
`vitastor-cli modify-user --groups <group1,group2,...> <username>`
|
||||
`vitastor-cli modify-user|user-modify --groups <group1,group2,...> <username>`
|
||||
|
||||
Create or update a user with the given name (matching TLS certificate CN).
|
||||
|
||||
|
||||
@@ -373,7 +373,7 @@ host stump
|
||||
|
||||
## ls-osd
|
||||
|
||||
`vitastor-cli osds|ls-osd|osd-ls [-l|--long]`
|
||||
`vitastor-cli osds|ls-osds|ls-osd|osd-ls [-l|--long]`
|
||||
|
||||
Показать список OSD, со статистикой ввода-вывода, если установлено -l.
|
||||
|
||||
@@ -403,7 +403,7 @@ OSD PARENT UP SIZE USED% TAGS WEIGHT BLOCK BITMAP
|
||||
|
||||
## pg-list
|
||||
|
||||
`vitastor-cli pg-list|pg-ls|list-pg|ls-pg|ls-pgs [OPTIONS] [state1+state2] [^state3] [...]`
|
||||
`vitastor-cli pg-list|pg-ls|list-pg|ls-pg|ls-pgs|pgs [OPTIONS] [state1+state2] [^state3] [...]`
|
||||
|
||||
Вывести список PG с состояними, удовлетворяющими любому из переданных фильтров (^ или !
|
||||
в начале фильтра означает отрицание). Опции:
|
||||
@@ -527,7 +527,7 @@ OSD PARENT UP SIZE USED% TAGS WEIGHT BLOCK BITMAP
|
||||
|
||||
## modify-user
|
||||
|
||||
`vitastor-cli modify-user --groups <group1,group2,...> <username>`
|
||||
`vitastor-cli modify-user|user-modify --groups <group1,group2,...> <username>`
|
||||
|
||||
Создать или изменить пользователя с указанным именем (совпадающим с CN TLS-сертификата).
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@ static const char* help_text =
|
||||
"vitastor-cli osd-tree [-l|--long]\n"
|
||||
" Show current OSD tree, optionally with I/O statistics if -l is specified.\n"
|
||||
"\n"
|
||||
"vitastor-cli osds|ls-osd|osd-ls [-l|--long]\n"
|
||||
"vitastor-cli osds|ls-osds|ls-osd|osd-ls [-l|--long]\n"
|
||||
" Show current OSDs as list, optionally with I/O statistics if -l is specified.\n"
|
||||
"\n"
|
||||
"vitastor-cli modify-osd [--tags tag1,tag2,...] [--reweight <number>] [--noout true/false] <osd_number>\n"
|
||||
@@ -253,7 +253,7 @@ static const char* help_text =
|
||||
"vitastor-cli ls-users|user-ls|ls-user|list-users [<name> ...]\n"
|
||||
" List users (only with specified names if passed).\n"
|
||||
"\n"
|
||||
"vitastor-cli modify-user --type <type> --groups group1,group2,... <username>\n"
|
||||
"vitastor-cli modify-user|user-modify --type <type> --groups group1,group2,... <username>\n"
|
||||
" Create or update user permissions. User names match CN of their certificates.\n"
|
||||
" --type TYPE Set user type: client or admin. Default is client.\n"
|
||||
" --groups GROUPS Set user's groups.\n"
|
||||
|
||||
@@ -250,17 +250,11 @@ resume_1:
|
||||
|
||||
json11::Json::array to_tree(const json11::Json::array & array)
|
||||
{
|
||||
std::set<uint64_t> listed;
|
||||
for (const auto & item: array)
|
||||
{
|
||||
listed.insert(item["inode_id"].uint64_value());
|
||||
}
|
||||
std::map<uint64_t, json11::Json::array> children;
|
||||
for (const auto & item: array)
|
||||
{
|
||||
uint64_t parent_id = item["parent_inode_id"].uint64_value();
|
||||
// Layers with a filtered out parent are shown as roots
|
||||
children[listed.find(parent_id) != listed.end() ? parent_id : 0].push_back(item);
|
||||
children[parent_id].push_back(item);
|
||||
}
|
||||
json11::Json::array tree;
|
||||
std::function<void(uint64_t, const std::string &)> add_children = [&](uint64_t parent_id, const std::string & prefix)
|
||||
|
||||
@@ -95,6 +95,8 @@ OLD=1 SCHEME=ec IMMEDIATE_COMMIT=1 ./test_rebalance_verify.sh
|
||||
|
||||
./test_dd.sh
|
||||
|
||||
./test_cli_help.sh
|
||||
|
||||
./test_root_node.sh
|
||||
|
||||
./test_switch_primary.sh
|
||||
@@ -122,7 +124,6 @@ OLD=1 ./test_corrupt_all.sh
|
||||
|
||||
./test_reweight_half.sh
|
||||
./test_snapshot_pool2.sh
|
||||
./test_ls_tree.sh
|
||||
./test_snapshot_read_bitmap.sh
|
||||
|
||||
TEST_NAME=csum_32k_dmj OSD_ARGS="--data_csum_type crc32c --csum_block_size 32k --inmemory_metadata false --inmemory_journal false" OFFSET_ARGS=$OSD_ARGS ./test_heal.sh
|
||||
|
||||
14
tests/test_cli_help.sh
Executable file
14
tests/test_cli_help.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash -ex
|
||||
|
||||
# Test that vitastor-cli --help knows every command name and alias the CLI accepts
|
||||
|
||||
. `dirname $0`/common.sh
|
||||
|
||||
for cmd in $(grep -o 'cmd\[0\] == "[^"]*"' src/cmd/cli.cpp | sed 's/.*== "//; s/"$//'); do
|
||||
build/src/cmd/vitastor-cli --help $cmd > ./testdata/help.txt 2>&1 || true
|
||||
if grep -q '^Unknown command' ./testdata/help.txt; then
|
||||
format_error "vitastor-cli --help $cmd does not know the command"
|
||||
fi
|
||||
done
|
||||
|
||||
format_green OK
|
||||
@@ -1,40 +0,0 @@
|
||||
#!/bin/bash -ex
|
||||
|
||||
# Test vitastor-cli ls --tree with filters which leave out parent layers
|
||||
|
||||
. `dirname $0`/run_3osds.sh
|
||||
|
||||
$VITASTOR_CLI create -s 128M testimg
|
||||
$VITASTOR_CLI snap-create testimg@snap1
|
||||
$VITASTOR_CLI create --parent testimg@snap1 testclone
|
||||
|
||||
$VITASTOR_CLI create-pool testpool2 -s 3 -n 4 --failure_domain osd
|
||||
wait_pool_up 30 2 3 4
|
||||
$VITASTOR_CLI create --parent testimg@snap1 -p testpool2 testclone2
|
||||
|
||||
# First column of each row without the header
|
||||
check_tree()
|
||||
{
|
||||
local expected=$1
|
||||
shift
|
||||
local rows=$($VITASTOR_CLI ls --tree "$@" | tail -n +2 | sed 's/ .*//' | tr '\n' ';')
|
||||
if [[ "$rows" != "$expected" ]]; then
|
||||
format_error "ls --tree $* shows '$rows', expected '$expected'"
|
||||
fi
|
||||
}
|
||||
|
||||
$VITASTOR_CLI ls --tree
|
||||
|
||||
check_tree 'testimg@snap1;├─ testclone;├─ testclone2;└─ testimg;'
|
||||
check_tree 'testimg@snap1;└─ testimg;' 'testimg*'
|
||||
# Layers whose parent is filtered out are shown as roots
|
||||
check_tree 'testimg;' testimg
|
||||
check_tree 'testclone;testimg;' testclone testimg
|
||||
check_tree 'testclone;' -n 1
|
||||
check_tree 'testclone2;' -p testpool2
|
||||
|
||||
if ! $VITASTOR_CLI ls --tree testimg | grep -q ' testimg@snap1 *$'; then
|
||||
format_error "ls --tree testimg should show testimg@snap1 as the parent"
|
||||
fi
|
||||
|
||||
format_green OK
|
||||
Reference in New Issue
Block a user