[sheepdog] [PATCH] cluster/corosync: avoid using CPG_* error codes

Andrew Niemantsverdriet andrew at rocky.edu
Wed Jul 25 04:15:25 CEST 2012


Corosync 2.0 is the new stable, the newer distros are packaging it rather
than the flat iron branch

_
/-\ ndrew Niemantsverdriet
Linux Systems Administrator
Rocky Mountain College
Sent from my phone
On Jul 24, 2012 8:06 PM, "Yunkai Zhang" <yunkai.me at gmail.com> wrote:

> Should we compatible with corosync 1.4.x? Or maybe we should update
> related manuals to tell user what have been changed.
>
> On Wed, Jul 25, 2012 at 1:06 AM, MORITA Kazutaka
> <morita.kazutaka at lab.ntt.co.jp> wrote:
> > It seems that CPG_* error codes are not defined in corosync 2.0.  This
> > patch uses CS_* instead of them.
> >
> > Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
> > ---
> >  sheep/cluster/corosync.c |   18 +++++++++---------
> >  1 files changed, 9 insertions(+), 9 deletions(-)
> >
> > diff --git a/sheep/cluster/corosync.c b/sheep/cluster/corosync.c
> > index 8a65e89..b3f6471 100644
> > --- a/sheep/cluster/corosync.c
> > +++ b/sheep/cluster/corosync.c
> > @@ -186,9 +186,9 @@ static int send_message(enum corosync_message_type
> type,
> >  retry:
> >         ret = cpg_mcast_joined(cpg_handle, CPG_TYPE_AGREED, iov,
> iov_cnt);
> >         switch (ret) {
> > -       case CPG_OK:
> > +       case CS_OK:
> >                 break;
> > -       case CPG_ERR_TRY_AGAIN:
> > +       case CS_ERR_TRY_AGAIN:
> >                 dprintf("failed to send message: retrying\n");
> >                 sleep(1);
> >                 goto retry;
> > @@ -655,13 +655,13 @@ static int corosync_join(struct sd_node *myself,
> >  retry:
> >         ret = cpg_join(cpg_handle, &cpg_group);
> >         switch (ret) {
> > -       case CPG_OK:
> > +       case CS_OK:
> >                 break;
> > -       case CPG_ERR_TRY_AGAIN:
> > +       case CS_ERR_TRY_AGAIN:
> >                 dprintf("failed to join the sheepdog group: retrying\n");
> >                 sleep(1);
> >                 goto retry;
> > -       case CPG_ERR_SECURITY:
> > +       case CS_ERR_SECURITY:
> >                 eprintf("permission denied to join the sheepdog
> group\n");
> >                 return -1;
> >         default:
> > @@ -710,8 +710,8 @@ static void corosync_handler(int listen_fd, int
> events, void *data)
> >                 goto out;
> >         }
> >
> > -       ret = cpg_dispatch(cpg_handle, CPG_DISPATCH_ALL);
> > -       if (ret != CPG_OK) {
> > +       ret = cpg_dispatch(cpg_handle, CS_DISPATCH_ALL);
> > +       if (ret != CS_OK) {
> >                 eprintf("cpg_dispatch returned %d\n", ret);
> >                 goto out;
> >         }
> > @@ -732,7 +732,7 @@ static int corosync_init(const char *option)
> >         };
> >
> >         ret = cpg_initialize(&cpg_handle, &cb);
> > -       if (ret != CPG_OK) {
> > +       if (ret != CS_OK) {
> >                 eprintf("failed to initialize cpg (%d) - "
> >                         "is corosync running?\n", ret);
> >                 return -1;
> > @@ -754,7 +754,7 @@ static int corosync_init(const char *option)
> >         this_node.pid = getpid();
> >
> >         ret = cpg_fd_get(cpg_handle, &fd);
> > -       if (ret != CPG_OK) {
> > +       if (ret != CS_OK) {
> >                 eprintf("failed to get cpg file descriptor (%d)\n", ret);
> >                 return -1;
> >         }
> > --
> > 1.7.2.5
> >
> > --
> > sheepdog mailing list
> > sheepdog at lists.wpkg.org
> > http://lists.wpkg.org/mailman/listinfo/sheepdog
>
>
>
> --
> Yunkai Zhang
> Work at Taobao
> --
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wpkg.org/pipermail/sheepdog/attachments/20120724/b1170f9f/attachment-0003.html>


More information about the sheepdog mailing list