Hi Minh,
Will something like below already working in dec_si_dep_state()
work for you if si is not found in the case mentioned in the ticket?
static uint32_t dec_si_dep_state(AVD_CL_CB *cb, NCS_MBCSV_CB_DEC *dec)
{
SaNameT name;
uint32_t si_dep_state;
TRACE_ENTER();
osaf_decode_sanamet(&dec->i_uba, &name);
AVD_SI *si = si_db->find(Amf::to_string(&name));
if (si == NULL) {
si = avd_si_new(&name);
osafassert(si != NULL);
avd_si_db_add(si);
}
osaf_decode_uint32(&dec->i_uba, &si_dep_state);
/* Update the fields received in this checkpoint message */
avd_sidep_si_dep_state_set(si, (AVD_SI_DEP_STATE)si_dep_state);
Thanks
-Nagu
> -----Original Message-----
> From: Minh Hon Chau [mailto:[email protected]]
> Sent: 26 August 2015 10:30
> To: [email protected]; Nagendra Kumar; Praveen Malviya
> Cc: [email protected]
> Subject: [PATCH 1 of 1] amfd: Standby controller reboots if adding additional
> SI in N+M model [#1457]
>
> osaf/services/saf/amf/amfd/si.cc | 89
> +++++++++++++++++++++++++++++++++++++++-
> 1 files changed, 88 insertions(+), 1 deletions(-)
>
>
> As N+M SU(s) are unlocked and having assignment, if dynamically adding an
> SI
> (without specified saAmfSIAdminState) that causes the standby controller
> reboots
>
> If additional SI is added without specified saAmfSIAdminState, the admin
> state
> will be set as UNLOCKED as default. And if the configuration has enough
> capability
> to establish new assignment for additional SI, the active amfd will checkpoint
> the current active assignment with standby amfd in the flow of CCB.
> Sometimes,
> this checkpoint comes to standby amfd before standby amfd creates
> additional SI
> by CCB apply. Therfore, standby amfd can't find the SI in checkpoint, then
> node
> reboots by a false assert.
>
> In AMF PR, 7.1.3 Add an SI in an SG without locking SG, the additonal SI
> should
> be in admin LOCKED state while it's being added. The patch adds validation
> for
> admin state of additional SI.
>
> diff --git a/osaf/services/saf/amf/amfd/si.cc
> b/osaf/services/saf/amf/amfd/si.cc
> --- a/osaf/services/saf/amf/amfd/si.cc
> +++ b/osaf/services/saf/amf/amfd/si.cc
> @@ -538,6 +538,89 @@ static int is_config_valid(const SaNameT
> return 1;
> }
>
> +/**
> + * Validates if a SG's admin state is valid for creating a SI
> + * Should only be called if the SI admin state is UNLOCKED
> + * @param si_dn
> + * @param attributes
> + * @param opdata
> + * @return true if so
> + */
> +static bool sg_admin_state_is_valid_for_si_create(const SaNameT *si_dn,
> + const SaImmAttrValuesT_2 **attributes,
> + const CcbUtilOperationData_t *opdata)
> +{
> + SaNameT sg_name = {0};
> +
> + if
> (immutil_getAttr(const_cast<SaImmAttrNameT>("saAmfSIProtectedbySG"),
> + attributes, 0, &sg_name) != SA_AIS_OK) {
> + TRACE("saAmfSIProtectedbySG is not specified for '%s'",
> si_dn->value);
> + return false;
> + }
> +
> + const AVD_SG *sg = sg_db->find(Amf::to_string(&sg_name));
> + if (sg != NULL) {
> + // SG had been created
> + // create SI is accepted under LOCKED SG, LOCKED-IN SG is
> fine either
> + if (sg->saAmfSGAdminState != SA_AMF_ADMIN_LOCKED ||
> + sg->saAmfSGAdminState !=
> SA_AMF_ADMIN_LOCKED_INSTANTIATION) {
> + TRACE("'%s' created UNLOCKED but '%s' is not
> locked",
> + si_dn->value, sg_name.value);
> + return false;
> + }
> + } else {
> + // SG does not exist in current model
> + // the check of sg existence should be already done in
> is_config_valid
> + osafassert(ccbutil_getCcbOpDataByDN(opdata->ccbId,
> &sg_name));
> + }
> +
> + return true;
> +}
> +
> +/**
> + * Validation performed when a SI is dynamically created with a CCB.
> + * @param dn
> + * @param attributes
> + * @param opdata
> + *
> + * @return bool
> + */
> +static bool is_ccb_create_config_valid(const SaNameT *dn,
> + const SaImmAttrValuesT_2 **attributes,
> + const CcbUtilOperationData_t *opdata)
> +{
> + SaAmfAdminStateT admstate;
> + SaAisErrorT rc;
> +
> + osafassert(opdata != NULL); // must be called in CCB context
> +
> + rc = immutil_getAttr("saAmfSIAdminState", attributes, 0,
> &admstate);
> + // Default value is UNLOCKED if created without a value
> + if (rc != SA_AIS_OK)
> + admstate = SA_AMF_ADMIN_UNLOCKED;
> +
> + // locked state is fine
> + if (admstate == SA_AMF_ADMIN_LOCKED)
> + return true;
> +
> + if (admstate != SA_AMF_ADMIN_UNLOCKED) {
> + report_ccb_validation_error(opdata,
> + "'%s' created with invalid saAmfSIAdminState (%u)",
> + dn->value, admstate);
> + return false;
> + }
> +
> + if (sg_admin_state_is_valid_for_si_create(dn, attributes, opdata))
> + return true;
> +
> + amflog(SA_LOG_SEV_NOTICE, "CCB %d creation of '%s' failed",
> + opdata->ccbId, dn->value);
> + report_ccb_validation_error(opdata,
> + "SG is not configured properly to allow creation of
> UNLOCKED SI");
> +
> + return false;
> +}
> +
> static AVD_SI *si_create(SaNameT *si_name, const SaImmAttrValuesT_2
> **attributes)
> {
> unsigned int i;
> @@ -1002,8 +1085,12 @@ static SaAisErrorT si_ccb_completed_cb(C
>
> switch (opdata->operationType) {
> case CCBUTIL_CREATE:
> - if (is_config_valid(&opdata->objectName, opdata-
> >param.create.attrValues, opdata))
> + if (is_config_valid(&opdata->objectName,
> + opdata->param.create.attrValues, opdata) &&
> + is_ccb_create_config_valid(&opdata->objectName,
> + opdata->param.create.attrValues,
> opdata)) {
> rc = SA_AIS_OK;
> + }
> break;
> case CCBUTIL_MODIFY:
> rc = si_ccb_completed_modify_hdlr(opdata);
------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel