Hi Zoran,

Reviewed and tested the patch.
The approach is good,the similar defect must exit for 2PBE from Opensaf4.4.

I suggest, to have MBCSV_VERSION 5 for 2PBE
and MBCSV_VERSION 6 for scabsence.

Either have a new defect for 2PBE or open a new defect.
First 2PBE patch should go and on top of 2PBE patch scabsence patch 
should follow.


Thanks,
Neel.


On Tuesday 01 March 2016 03:39 PM, Zoran Milinkovic wrote:
>   osaf/services/saf/immsv/immd/immd_cb.h    |   2 +-
>   osaf/services/saf/immsv/immd/immd_evt.c   |   3 -
>   osaf/services/saf/immsv/immd/immd_mbcsv.c |  56 
> ++++++++++++++++++++++++++++++-
>   3 files changed, 56 insertions(+), 5 deletions(-)
>
>
> SC absence allowed part will prevent that controllers don't have different SC 
> absence configuration.
> When 2PBE or SC absence allowed misconfiguration on controllers is detected, 
> IMMD will exit in cold sync.
>
> After few times restarting due to SC absence or 2PBE misconfiguration, AMF 
> will reboot the node.
>
> diff --git a/osaf/services/saf/immsv/immd/immd_cb.h 
> b/osaf/services/saf/immsv/immd/immd_cb.h
> --- a/osaf/services/saf/immsv/immd/immd_cb.h
> +++ b/osaf/services/saf/immsv/immd/immd_cb.h
> @@ -39,7 +39,7 @@
>            IMMD_WRT_IMMND_SUBPART_VER_MIN + 1 )
>   
>   #define IMMSV_IMMD_MBCSV_VERSION_MIN 4
> -#define IMMSV_IMMD_MBCSV_VERSION 4
> +#define IMMSV_IMMD_MBCSV_VERSION 5
>   
>   typedef struct immd_saved_fevs_msg {
>       IMMSV_FEVS fevsMsg;
> diff --git a/osaf/services/saf/immsv/immd/immd_evt.c 
> b/osaf/services/saf/immsv/immd/immd_evt.c
> --- a/osaf/services/saf/immsv/immd/immd_evt.c
> +++ b/osaf/services/saf/immsv/immd/immd_evt.c
> @@ -721,9 +721,6 @@ static void immd_accept_node(IMMD_CB *cb
>                       if(cb->mIs2Pbe) {
>                               /* 2PBE is true => joining SC must sync AND get 
> informed of 2PBE. */
>                               accept_evt.info.immnd.info.ctrl.canBeCoord = 3;
> -                     } else {
> -                             /* 1PBE or 0PBE joining SC must sync */
> -                             accept_evt.info.immnd.info.ctrl.canBeCoord = 
> (node_info->isOnController)?1:(cb->mScAbsenceAllowed)?4:0;
>                       }
>               }
>       } else if(cb->immnd_coord == 0 && cb->mScAbsenceAllowed && 
> knownVeteran) {
> diff --git a/osaf/services/saf/immsv/immd/immd_mbcsv.c 
> b/osaf/services/saf/immsv/immd/immd_mbcsv.c
> --- a/osaf/services/saf/immsv/immd/immd_mbcsv.c
> +++ b/osaf/services/saf/immsv/immd/immd_mbcsv.c
> @@ -628,7 +628,8 @@ static uint32_t mbcsv_enc_msg_resp(IMMD_
>       TRACE_ENTER();
>       uint32_t rc = NCSCC_RC_SUCCESS;
>       uint8_t *header, num_fevs = 0, *sync_cnt_ptr;
> -     uint8_t *uns32_ptr, *uns64_ptr, *uns8_ptr;
> +     uint8_t *uns32_ptr, *uns64_ptr, *uns8_ptr, *uns16_ptr;
> +     uint16_t peer_version;
>   
>       /* COLD_SYNC_RESP IS DONE BY THE ACTIVE */
>       if (cb->ha_state == SA_AMF_HA_STANDBY) {
> @@ -644,6 +645,9 @@ static uint32_t mbcsv_enc_msg_resp(IMMD_
>               return rc;
>       }
>   
> +     peer_version = m_NCS_MBCSV_FMT_GET(arg->info.encode.i_peer_version,
> +                     IMMSV_IMMD_MBCSV_VERSION, IMMSV_IMMD_MBCSV_VERSION_MIN);
> +
>       /* First reserve space to store the number of X that will be sent */
>   
>       header = ncs_enc_reserve_space(&arg->info.encode.io_uba, 
> sizeof(uint8_t));
> @@ -759,6 +763,18 @@ static uint32_t mbcsv_enc_msg_resp(IMMD_
>       ncs_enc_claim_space(&arg->info.encode.io_uba, sizeof(uint8_t));
>       ncs_encode_8bit(&uns8_ptr, 0x0);
>   
> +     if(peer_version >= 5) {
> +             uns8_ptr = ncs_enc_reserve_space(&arg->info.encode.io_uba, 
> sizeof(uint8_t));
> +             osafassert(uns8_ptr);
> +             ncs_enc_claim_space(&arg->info.encode.io_uba, sizeof(uint8_t));
> +             ncs_encode_8bit(&uns8_ptr, cb->mIs2Pbe);
> +
> +             uns16_ptr = ncs_enc_reserve_space(&arg->info.encode.io_uba, 
> sizeof(uint16_t));
> +             osafassert(uns16_ptr);
> +             ncs_enc_claim_space(&arg->info.encode.io_uba, sizeof(uint16_t));
> +             ncs_encode_16bit(&uns16_ptr, cb->mScAbsenceAllowed);
> +     }
> +
>       /* Alter this to follow same pattern as logsv */
>       if (num_fevs < IMMD_MBCSV_MAX_MSG_CNT) {
>               if (arg->info.encode.io_msg_type == 
> NCS_MBCSV_MSG_COLD_SYNC_RESP) {
> @@ -1030,6 +1046,7 @@ static uint32_t mbcsv_dec_sync_resp(IMMD
>   {
>       uint8_t *ptr, num_fevs, continue_marker, data[16];
>       uint32_t count = 0, rc = NCSCC_RC_SUCCESS;
> +     uint16_t peer_version;
>   
>       TRACE_ENTER();
>       TRACE_5("RECEIVED COLD SYNC MESSAGE");
> @@ -1039,6 +1056,14 @@ static uint32_t mbcsv_dec_sync_resp(IMMD
>               return NCSCC_RC_SUCCESS;
>       }
>   
> +     peer_version = m_NCS_MBCSV_FMT_GET(arg->info.decode.i_peer_version,
> +                     IMMSV_IMMD_MBCSV_VERSION, IMMSV_IMMD_MBCSV_VERSION_MIN);
> +
> +     if(cb->mScAbsenceAllowed && peer_version < 5) {
> +             LOG_ER("SC absence allowed is allowed on standby IMMD. Active 
> IMMD is not from OpenSAF 5.0 or above. Exiting.");
> +             exit(1);
> +     }
> +
>       /* 1. Decode the 1st uint8_t region ,  to get the num of fevs msgs to 
> sync */
>       ptr = ncs_dec_flatten_space(&arg->info.decode.i_uba, data, 
> sizeof(uint8_t));
>       num_fevs = ncs_decode_8bit(&ptr);
> @@ -1140,6 +1165,35 @@ static uint32_t mbcsv_dec_sync_resp(IMMD
>               ncs_dec_skip_space(&arg->info.decode.i_uba, sizeof(uint8_t));
>       }
>   
> +     if(peer_version >= 5) {
> +             uint8_t is2Pbe;
> +             uint16_t scAbsenceAllowed;
> +
> +             ptr = ncs_dec_flatten_space(&arg->info.decode.i_uba, data, 
> sizeof(uint8_t));
> +             is2Pbe = ncs_decode_8bit(&ptr);
> +             ncs_dec_skip_space(&arg->info.decode.i_uba, sizeof(uint8_t));
> +
> +             if(cb->mIs2Pbe && !is2Pbe) {
> +                     LOG_ER("2PBE is disabled on active IMMD. Exiting.");
> +                     exit(1);
> +             }
> +             if(!cb->mIs2Pbe && is2Pbe) {
> +                     LOG_ER("2PBE is enabled on active IMMD. Exiting.");
> +                     exit(1);
> +             }
> +
> +             ptr = ncs_dec_flatten_space(&arg->info.decode.i_uba, data, 
> sizeof(uint16_t));
> +             scAbsenceAllowed = ncs_decode_16bit(&ptr);
> +             ncs_dec_skip_space(&arg->info.decode.i_uba, sizeof(uint16_t));
> +
> +             if(cb->mScAbsenceAllowed != scAbsenceAllowed) {
> +                     LOG_ER("SC absence allowed in not the same as on active 
> IMMD. "
> +                                     "Active: %u, Standby: %d. Exiting.",
> +                                     scAbsenceAllowed, 
> cb->mScAbsenceAllowed);
> +                     exit(1);
> +             }
> +     }
> +
>       TRACE_LEAVE();
>       return rc;
>   }


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://makebettercode.com/inteldaal-eval
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to