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

Yunkai Zhang yunkai.me at gmail.com
Wed Jul 25 04:06:44 CEST 2012


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



More information about the sheepdog mailing list