[sheepdog] [PATCH 1/2] collie: show progress in an output of node recovery
Hitoshi Mitake
mitake.hitoshi at lab.ntt.co.jp
Thu Aug 8 03:52:07 CEST 2013
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);
+ } else {
+ printf("%4d %-20s%5d%11d", i, host,
+ sd_nodes[i].nr_vnodes, sd_nodes[i].zone);
+
+ if (state.in_recovery)
+ printf("%11.1f%%",
+ 100 * (float)state.nr_finished
+ / state.nr_total);
+
+ printf("\n");
+ }
}
}
--
1.7.10.4
More information about the sheepdog
mailing list