[sheepdog] [PATCH v2] sheep: let gateway node exit in a case of gateway only cluster
Hitoshi Mitake
mitake.hitoshi at lab.ntt.co.jp
Wed Dec 17 06:09:50 CET 2014
At Mon, 15 Dec 2014 23:14:55 +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 | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
Yang, long, when you have time, could you test this patch?
Thanks,
Hitoshi
>
> v2: remove needless logging
>
> diff --git a/sheep/group.c b/sheep/group.c
> index 095b7c5..5dc3284 100644
> --- a/sheep/group.c
> +++ b/sheep/group.c
> @@ -1151,6 +1151,18 @@ 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) {
> + 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 +1189,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