[sheepdog] [PATCH 1/2] collie: show progress in an output of node recovery
Liu Yuan
namei.unix at gmail.com
Thu Aug 8 04:12:39 CEST 2013
On Thu, Aug 08, 2013 at 10:52:07AM +0900, Hitoshi Mitake wrote:
> This patch lets collie output recovery progress. Below is an example
> of a new output.
>
> Id Host:Port V-Nodes Zone Progress
> 0 10.68.13.1:7000 64 17646602 56.3%
> 1 10.68.13.2:7000 64 34423818 37.2%
> 2 10.68.13.3:7000 64 51201034 18.1%
> 3 10.68.13.4:7000 64 67978250 68.9%
> 4 10.68.13.5:7000 64 84755466 3.9%
> 5 10.68.13.6:7000 64 101532682 52.6%
> 6 10.68.13.7:7000 64 118309898 77.9%
> 7 10.68.13.8:7000 64 135087114 38.9%
> 8 10.68.13.9:7000 64 151864330 8.7%
> 9 10.68.13.10:7000 64 168641546 97.1%
> 10 10.68.13.11:7000 64 185418762 1.1%
> 11 10.68.13.12:7000 64 202195978 25.6%
>
> Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
> ---
> collie/node.c | 22 ++++++++++++++++++----
> 1 file changed, 18 insertions(+), 4 deletions(-)
>
> diff --git a/collie/node.c b/collie/node.c
> index 0ab665d..3fe5eb9 100644
> --- a/collie/node.c
> +++ b/collie/node.c
> @@ -206,7 +206,8 @@ static int node_recovery(int argc, char **argv)
>
> if (!raw_output) {
> printf("Nodes In Recovery:\n");
> - printf(" Id Host:Port V-Nodes Zone\n");
> + printf(" Id Host:Port V-Nodes Zone"
> + " Progress\n");
> }
>
> for (i = 0; i < sd_nodes_nr; i++) {
> @@ -227,9 +228,22 @@ static int node_recovery(int argc, char **argv)
> if (state.in_recovery) {
> addr_to_str(host, sizeof(host),
> sd_nodes[i].nid.addr, sd_nodes[i].nid.port);
> - printf(raw_output ? "%d %s %d %d\n" : "%4d %-20s%5d%11d\n",
> - i, host, sd_nodes[i].nr_vnodes,
> - sd_nodes[i].zone);
> + if (raw_output) {
> + printf("%d %s %d %d %"PRIu64" %"PRIu64"\n", i,
> + host, sd_nodes[i].nr_vnodes,
> + sd_nodes[i].zone, state.nr_finished,
> + state.nr_total);
isn't better to print state.nr_finished/state.nr_total for the last field?
> + } else {
> + printf("%4d %-20s%5d%11d", i, host,
> + sd_nodes[i].nr_vnodes, sd_nodes[i].zone);
> +
> + if (state.in_recovery)
This if check isn't necessary.
Thanks
Yuan
More information about the sheepdog
mailing list