[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 08:42:27 CET 2014


At Wed, 17 Dec 2014 15:40:35 +0800,
徐小龙 wrote:
> 
> [1  <text/plain; UTF-8 (7bit)>]
> hi,Hitoshi
>    we've tested the patch. Our test method is:
> 
> 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.
> 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)
> 
> Thanks,
> Yang,Long

Thanks a lot for testing! Could you give me your Tested-by: tags?
(e.g. Tested-by: Yang Zhang <3100100878 at zju.edu.cn>, Tested-by: Long <nxtxiaolong at gmail.com>)

Thanks,
Hitoshi

> 
> On Wed, Dec 17, 2014 at 1:09 PM, Hitoshi Mitake <
> mitake.hitoshi at lab.ntt.co.jp> wrote:
> >
> > 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
> > >
> >
> [2  <text/html; UTF-8 (quoted-printable)>]
> 



More information about the sheepdog mailing list