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: duron...@qq.com Cc: Yang Zhang <3100100...@zju.edu.cn> Cc: long <nxtxiaol...@gmail.com> Signed-off-by: Hitoshi Mitake <mitake.hito...@lab.ntt.co.jp> --- sheep/group.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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 -- sheepdog mailing list sheepdog@lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/sheepdog