<div dir="ltr">hi,Hitoshi<div>   we've tested the patch. Our test method is:</div><div><br></div><div>We attached a 20G sheepdog VDI to a VM holded by openstack. And we created a 2G file which we have it's md5 in hand in the VDI.</div><div>We killed the non-gateway nodes in the middle of the process, then restarted the cluster. The process resumed and the content of the file is right(same md5)</div><div><br></div><div>Thanks,</div><div>Yang,Long</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 17, 2014 at 1:09 PM, Hitoshi Mitake <span dir="ltr"><<a href="mailto:mitake.hitoshi@lab.ntt.co.jp" target="_blank">mitake.hitoshi@lab.ntt.co.jp</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">At Mon, 15 Dec 2014 23:14:55 +0900,<br>
<span class="">Hitoshi Mitake wrote:<br>
><br>
> When a cluster has gateway nodes only, it means the gateway nodes<br>
> doesn't contribute to I/O of VMs. So this patch simply let them exit<br>
> and avoid the below recovery issue.<br>
><br>
> Related issue:<br>
> <a href="https://bugs.launchpad.net/sheepdog-project/+bug/1327037" target="_blank">https://bugs.launchpad.net/sheepdog-project/+bug/1327037</a><br>
><br>
> Cc: <a href="mailto:duron800@qq.com">duron800@qq.com</a><br>
> Cc: Yang Zhang <<a href="mailto:3100100878@zju.edu.cn">3100100878@zju.edu.cn</a>><br>
> Cc: long <<a href="mailto:nxtxiaolong@gmail.com">nxtxiaolong@gmail.com</a>><br>
> Signed-off-by: Hitoshi Mitake <<a href="mailto:mitake.hitoshi@lab.ntt.co.jp">mitake.hitoshi@lab.ntt.co.jp</a>><br>
> ---<br>
>  sheep/group.c | 17 +++++++++++++++++<br>
>  1 file changed, 17 insertions(+)<br>
<br>
</span>Yang, long, when you have time, could you test this patch?<br>
<br>
Thanks,<br>
Hitoshi<br>
<div class="HOEnZb"><div class="h5"><br>
><br>
> v2: remove needless logging<br>
><br>
> diff --git a/sheep/group.c b/sheep/group.c<br>
> index 095b7c5..5dc3284 100644<br>
> --- a/sheep/group.c<br>
> +++ b/sheep/group.c<br>
> @@ -1151,6 +1151,18 @@ main_fn void sd_accept_handler(const struct sd_node *joined,<br>
>       }<br>
>  }<br>
><br>
> +static bool is_gateway_only_cluster(const struct rb_root *nroot)<br>
> +{<br>
> +     struct sd_node *n;<br>
> +<br>
> +     rb_for_each_entry(n, nroot, rb) {<br>
> +             if (n->space)<br>
> +                     return false;<br>
> +     }<br>
> +<br>
> +     return true;<br>
> +}<br>
> +<br>
>  main_fn void sd_leave_handler(const struct sd_node *left,<br>
>                             const struct rb_root *nroot, size_t nr_nodes)<br>
>  {<br>
> @@ -1177,6 +1189,11 @@ main_fn void sd_leave_handler(const struct sd_node *left,<br>
>       old_vnode_info = main_thread_get(current_vnode_info);<br>
>       main_thread_set(current_vnode_info, alloc_vnode_info(nroot));<br>
>       if (sys->cinfo.status == SD_STATUS_OK) {<br>
> +             if (is_gateway_only_cluster(nroot)) {<br>
> +                     sd_info("only gateway nodes are remaining, exiting");<br>
> +                     exit(0);<br>
> +             }<br>
> +<br>
>               ret = inc_and_log_epoch();<br>
>               if (ret != 0)<br>
>                       panic("cannot log current epoch %d", sys->cinfo.epoch);<br>
> --<br>
> 1.9.1<br>
><br>
</div></div></blockquote></div></div>