[sheepdog] [PATCH] sheep: let gateway node exit in a case of gateway only cluster

Hitoshi Mitake mitake.hitoshi at gmail.com
Mon Dec 15 15:15:27 CET 2014


At Mon, 15 Dec 2014 23:12:12 +0900,
Hitoshi Mitake wrote:
> 
> When a cluster has gateway nodes only, it means the gateway nodes
> doesn't contribute to I/O of VMs. So this patch simply let them exit
> and avoid the below recovery issue.
> 
> Related issue:
> https://bugs.launchpad.net/sheepdog-project/+bug/1327037
> 
> Cc: duron800 at qq.com
> Cc: Yang Zhang <3100100878 at zju.edu.cn>
> Cc: long <nxtxiaolong at gmail.com>
> Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
> ---
>  sheep/group.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)

Sorry, please ignore this one. It contains obsolete logging.

Thanks,
Hitoshi

> 
> diff --git a/sheep/group.c b/sheep/group.c
> index 095b7c5..833f02f 100644
> --- a/sheep/group.c
> +++ b/sheep/group.c
> @@ -1151,6 +1151,20 @@ main_fn void sd_accept_handler(const struct sd_node *joined,
>  	}
>  }
>  
> +static bool is_gateway_only_cluster(const struct rb_root *nroot)
> +{
> +	struct sd_node *n;
> +
> +	rb_for_each_entry(n, nroot, rb) {
> +		sd_info("%s", node_to_str(n));
> +		sd_info("%lu", n->space);
> +		if (n->space)
> +			return false;
> +	}
> +
> +	return true;
> +}
> +
>  main_fn void sd_leave_handler(const struct sd_node *left,
>  			      const struct rb_root *nroot, size_t nr_nodes)
>  {
> @@ -1177,6 +1191,11 @@ main_fn void sd_leave_handler(const struct sd_node *left,
>  	old_vnode_info = main_thread_get(current_vnode_info);
>  	main_thread_set(current_vnode_info, alloc_vnode_info(nroot));
>  	if (sys->cinfo.status == SD_STATUS_OK) {
> +		if (is_gateway_only_cluster(nroot)) {
> +			sd_info("only gateway nodes are remaining, exiting");
> +			exit(0);
> +		}
> +
>  		ret = inc_and_log_epoch();
>  		if (ret != 0)
>  			panic("cannot log current epoch %d", sys->cinfo.epoch);
> -- 
> 1.9.1
> 



More information about the sheepdog mailing list