Do not use \r if output is not a terminal
Test / buildenv (push) Successful in 13s Details
Test / build (push) Successful in 2m31s Details
Test / test_cas (push) Successful in 14s Details
Test / make_test (push) Successful in 38s Details
Test / test_change_pg_count (push) Successful in 37s Details
Test / test_change_pg_size (push) Successful in 11s Details
Test / test_change_pg_count_ec (push) Successful in 35s Details
Test / test_create_nomaxid (push) Successful in 10s Details
Test / test_etcd_fail (push) Successful in 52s Details
Test / test_add_osd (push) Successful in 2m49s Details
Test / test_interrupted_rebalance (push) Successful in 2m43s Details
Test / test_interrupted_rebalance_imm (push) Successful in 2m47s Details
Test / test_failure_domain (push) Successful in 11s Details
Test / test_interrupted_rebalance_ec (push) Successful in 2m6s Details
Test / test_snapshot (push) Successful in 21s Details
Test / test_minsize_1 (push) Successful in 15s Details
Test / test_interrupted_rebalance_ec_imm (push) Successful in 1m25s Details
Test / test_snapshot_ec (push) Successful in 30s Details
Test / test_rm (push) Successful in 17s Details
Test / test_move_reappear (push) Successful in 22s Details
Test / test_snapshot_down (push) Successful in 30s Details
Test / test_snapshot_down_ec (push) Successful in 31s Details
Test / test_splitbrain (push) Successful in 25s Details
Test / test_snapshot_chain (push) Successful in 2m26s Details
Test / test_snapshot_chain_ec (push) Successful in 3m5s Details
Test / test_rebalance_verify_imm (push) Successful in 3m31s Details
Test / test_rebalance_verify (push) Successful in 4m9s Details
Test / test_switch_primary (push) Successful in 44s Details
Test / test_write (push) Successful in 44s Details
Test / test_write_no_same (push) Successful in 20s Details
Test / test_write_xor (push) Successful in 50s Details
Test / test_rebalance_verify_ec_imm (push) Successful in 3m23s Details
Test / test_rebalance_verify_ec (push) Successful in 5m48s Details
Test / test_heal_pg_size_2 (push) Successful in 4m12s Details
Test / test_heal_ec (push) Successful in 5m20s Details
Test / test_heal_csum_32k_dmj (push) Successful in 4m57s Details
Test / test_heal_csum_32k_dj (push) Successful in 7m28s Details
Test / test_heal_csum_32k (push) Successful in 6m38s Details
Test / test_scrub (push) Successful in 1m39s Details
Test / test_heal_csum_4k_dj (push) Successful in 6m57s Details
Test / test_heal_csum_4k_dmj (push) Successful in 6m59s Details
Test / test_scrub_zero_osd_2 (push) Successful in 46s Details
Test / test_scrub_xor (push) Successful in 46s Details
Test / test_scrub_pg_size_3 (push) Successful in 1m51s Details
Test / test_scrub_ec (push) Successful in 1m6s Details
Test / test_heal_csum_4k (push) Successful in 5m36s Details
Test / test_scrub_pg_size_6_pg_minsize_4_osd_count_6_ec (push) Successful in 23s Details

Vitaliy Filippov 2024-02-28 21:22:19 +03:00
parent 12b11b68f1
commit 836869f823
4 changed files with 23 additions and 7 deletions

View File

@ -125,7 +125,7 @@ static const char* help_text =
" --parallel_osds M Work with M osds in parallel when possible (default 4)\n"
" --progress 1|0 Report progress (default 1)\n"
" --cas 1|0 Use CAS writes for flatten, merge, rm (default is decide automatically)\n"
" --no-color Disable colored output\n"
" --color 1|0 Enable/disable colored output and CR symbols (default 1 if stdout is a terminal)\n"
" --json JSON output\n"
;

View File

@ -1,6 +1,7 @@
// Copyright (c) Vitaliy Filippov, 2019+
// License: VNPL-1.1 (see README.md for details)
#include <unistd.h>
#include "str_util.h"
#include "cluster_client.h"
#include "cli.h"
@ -113,7 +114,12 @@ void cli_tool_t::parse_config(json11::Json::object & cfg)
else
kv_it++;
}
color = !cfg["no_color"].bool_value();
if (cfg.find("no_color") != cfg.end())
color = !cfg["no_color"].bool_value();
else if (cfg.find("color") != cfg.end())
color = cfg["color"].bool_value();
else
color = isatty(1);
json_output = cfg["json"].bool_value();
iodepth = cfg["iodepth"].uint64_value();
if (!iodepth)

View File

@ -275,7 +275,9 @@ struct snap_merger_t
processed++;
if (parent->progress && !(processed % 128))
{
printf("\rFiltering target blocks: %ju/%ju", processed, to_process);
fprintf(stderr, parent->color
? "\rFiltering target blocks: %ju/%ju"
: "Filtering target blocks: %ju/%ju\n", processed, to_process);
}
}
if (in_flight > 0 || oit != merge_offsets.end())
@ -285,7 +287,9 @@ struct snap_merger_t
}
if (parent->progress)
{
printf("\r%ju full blocks of target filtered out\n", to_process-merge_offsets.size());
fprintf(stderr, parent->color
? "\r%ju full blocks of target filtered out\n"
: "%ju full blocks of target filtered out\n", to_process-merge_offsets.size());
}
}
state = 3;
@ -320,7 +324,9 @@ struct snap_merger_t
processed++;
if (parent->progress && !(processed % 128))
{
printf("\rOverwriting blocks: %ju/%ju", processed, to_process);
fprintf(stderr, parent->color
? "\rOverwriting blocks: %ju/%ju"
: "Overwriting blocks: %ju/%ju\n", processed, to_process);
}
}
if (in_flight == 0 && rwo_error.size())
@ -339,7 +345,9 @@ struct snap_merger_t
}
if (parent->progress)
{
printf("\rOverwriting blocks: %ju/%ju\n", to_process, to_process);
fprintf(stderr, parent->color
? "\rOverwriting blocks: %ju/%ju\n"
: "Overwriting blocks: %ju/%ju\n", to_process, to_process);
}
// Done
result = (cli_result_t){ .text = "Done, layers from "+from_name+" to "+to_name+" merged into "+target_name };

View File

@ -213,7 +213,9 @@ struct rm_inode_t
}
if (parent->progress && total_count > 0 && total_done*1000/total_count != total_prev_pct)
{
fprintf(stderr, "\rRemoved %ju/%ju objects, %ju more PGs to list...", total_done, total_count, pgs_to_list);
fprintf(stderr, parent->color
? "\rRemoved %ju/%ju objects, %ju more PGs to list..."
: "Removed %ju/%ju objects, %ju more PGs to list...\n", total_done, total_count, pgs_to_list);
total_prev_pct = total_done*1000/total_count;
}
if (lists_done && !lists.size())