[sheepdog] [PATCH] collie: fix error output of 'collie node info'
Liu Yuan
namei.unix at gmail.com
Mon Aug 27 13:44:15 CEST 2012
On 08/27/2012 07:39 PM, levin li wrote:
> From: levin li <xingke.lwp at taobao.com>
>
>
> Signed-off-by: levin li <xingke.lwp at taobao.com>
> ---
> collie/node.c | 1 +
> sheep/ops.c | 5 ++++-
> 2 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/collie/node.c b/collie/node.c
> index a5a57a3..63bb27a 100644
> --- a/collie/node.c
> +++ b/collie/node.c
> @@ -79,6 +79,7 @@ static int node_info(int argc, char **argv)
> if (!ret) {
> printf(raw_output ? "%d %s %s %d%%\n" : "%2d\t%s\t%s\t%3d%%\n",
> i, store_str, free_str,
> + rsp->store_size == 0 ? 0 :
> (int)(((double)(rsp->store_size - rsp->store_free) / rsp->store_size) * 100));
> success++;
> }
> diff --git a/sheep/ops.c b/sheep/ops.c
> index 4afd0a2..ccb1c5e 100644
> --- a/sheep/ops.c
> +++ b/sheep/ops.c
> @@ -95,7 +95,10 @@ static int stat_sheep(uint64_t *store_size, uint64_t *store_free, uint32_t epoch
> ret = SD_RES_SUCCESS;
>
> *store_size = sys->disk_space;
> - *store_free = sys->disk_space - used;
> + if (sys->gateway_only)
> + *store_free = 0;
> + else
> + *store_free = sys->disk_space - used;
> out:
> strbuf_release(&store_dir);
> return ret;
>
Applied, thanks.
Yuan
More information about the sheepdog
mailing list