Compare commits

...

1 Commits

Author SHA1 Message Date
be45066d08 Fix missing space in vitastor-cli rm-osd "still up" message
rm-osd printed "OSD 1is still up" and "OSDs 2, 3are still up" because
the verb was appended to the OSD list without a space. Also say "it"
instead of "them" when only one OSD is up.
2026-10-20 10:37:33 +03:00
3 changed files with 18 additions and 1 deletions

View File

@@ -170,7 +170,8 @@ struct rm_osd_t
}
if (still_up.size() && !allow_up)
error += (still_up.size() == 1 ? "OSD " : "OSDs ") + implode(", ", still_up) +
(still_up.size() == 1 ? "is" : "are") + " still up. Use `vitastor-disk purge` to delete them.\n";
(still_up.size() == 1 ? " is" : " are") + " still up. Use `vitastor-disk purge` to delete " +
(still_up.size() == 1 ? "it" : "them") + ".\n";
if (is_dataloss && !force_dataloss && !dry_run)
error += "OSDs not deleted. Please move data to other OSDs or bypass this check with --allow-data-loss if you know what you are doing.\n";
else if (is_warning && !force_warning && !dry_run)

View File

@@ -66,6 +66,8 @@ OLD=1 ./test_move_reappear.sh
./test_rm_degraded.sh
./test_rm_osd_msg.sh
./test_snapshot_chain.sh
SCHEME=ec ./test_snapshot_chain.sh
ENCRYPTED=1 ./test_snapshot_chain.sh

14
tests/test_rm_osd_msg.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/bash -ex
# Test the rm-osd message for OSDs that are still up
. `dirname $0`/run_3osds.sh
$VITASTOR_CLI rm-osd --dry-run 1 > ./testdata/one.txt 2>&1 && format_error "rm-osd of an up OSD was not refused"
cat ./testdata/one.txt
grep -q '^OSD 1 is still up\. Use `vitastor-disk purge` to delete it\.$' ./testdata/one.txt || format_error "bad message for one OSD"
$VITASTOR_CLI rm-osd --dry-run 1 2 > ./testdata/two.txt 2>&1 && format_error "rm-osd of up OSDs was not refused"
cat ./testdata/two.txt
grep -q '^OSDs 1, 2 are still up\. Use `vitastor-disk purge` to delete them\.$' ./testdata/two.txt || format_error "bad message for two OSDs"
format_green OK