Hi Lennart,

 From IMM Version A.2.17, the IMM modify callback will have canonical 
attributes.
All the attributes in the class along with the modified attributes.

The code in CcbApplyCallback in the file 
"src/smf/smfd/SmfImmApplierHdl.cc", if the attrmods are more than one 
then the following correction has to be made:

diff --git a/src/smf/smfd/SmfImmApplierHdl.cc 
b/src/smf/smfd/SmfImmApplierHdl.cc
--- a/src/smf/smfd/SmfImmApplierHdl.cc
+++ b/src/smf/smfd/SmfImmApplierHdl.cc
@@ -455,6 +455,7 @@ static void CcbApplyCallback(SaImmOiHand
      if (attribute_name_.compare(attribute.attrName) != 0) {
        // Not found
        attrMod = opdata->param.modify.attrMods[i];
+      attribute = attrMod->modAttr;
        continue;
      }


I tested with A.2.17 IMM version, the longdns are working fine.. If you 
agree with the above patch, re-publish the patch.
The #2442 has to go before #2431.

Thanks,
Neel.


On 2017/04/27 06:40 PM, Lennart Lund wrote:
> SMF has an IMM applier to track changes of attribute longDnsAllowed in 
> OpensafImm class.
> Fix that the applier does not find the value if the list of attributes to be 
> handled in the
> apply callback contains more than one attribute. Also if the found attribute 
> is not the serached
> one the cached attribute value is set to invalid
> ---
>   src/smf/smfd/SmfImmApplierHdl.cc | 28 +++++++++++++++-------------
>   1 file changed, 15 insertions(+), 13 deletions(-)
>
> diff --git a/src/smf/smfd/SmfImmApplierHdl.cc 
> b/src/smf/smfd/SmfImmApplierHdl.cc
> index d325ec4..693446b 100644
> --- a/src/smf/smfd/SmfImmApplierHdl.cc
> +++ b/src/smf/smfd/SmfImmApplierHdl.cc
> @@ -436,15 +436,12 @@ static void CcbApplyCallback(SaImmOiHandleT 
> immOiHandle, SaImmOiCcbIdT ccbId) {
>   
>     objName = osaf_extended_name_borrow(&opdata->objectName);
>     if (object_name_.compare(objName) != 0) {
> -    TRACE("%s: Object \"%s\" not an OpensafConfig object", __FUNCTION__,
> -          objName);
> +    LOG_NO("%s: Object \"%s\" wrong object", __FUNCTION__, objName);
>       goto done;
>     }
>   
> -  /* Read value in opensafNetworkName
> -   * Note: This is implemented as a loop in case more attributes are
> -   *       added in the class in the future. For now the only
> -   *       attribute of interest here is opensafNetworkName
> +  /* Read value
> +   * Note: For now the only attribute of interest here is opensafNetworkName
>      */
>     TRACE("%s: Read value in attributes", __FUNCTION__);
>     attrMod = opdata->param.modify.attrMods[0];
> @@ -455,21 +452,26 @@ static void CcbApplyCallback(SaImmOiHandleT 
> immOiHandle, SaImmOiCcbIdT ccbId) {
>       if (attribute_name_.compare(attribute.attrName) != 0) {
>         // Not found
>         attrMod = opdata->param.modify.attrMods[i];
> +      attribute = attrMod->modAttr;
>         continue;
>       }
>   
>       // Attribute found
>       value = static_cast<SaUint32T *>(attribute.attrValues[0]);
> +    TRACE("Attribute found: attrName '%s', value = %d",
> +          attribute.attrName, *value);
>       break;
>     }
>   
> -  if (value == nullptr) {
> -    TRACE("%s: Value is nullptr", __FUNCTION__);
> -    SetAttributeValue("");
> -    attribute_value_is_valid_ = false;
> -  } else {
> -    SetAttributeValue(std::to_string(*value));
> -    attribute_value_is_valid_ = true;
> +  if (attrMod != nullptr) {
> +    if (value == nullptr) {
> +      TRACE("%s: Value is nullptr", __FUNCTION__);
> +      SetAttributeValue("");
> +      attribute_value_is_valid_ = false;
> +    } else {
> +      SetAttributeValue(std::to_string(*value));
> +      attribute_value_is_valid_ = true;
> +    }
>     }
>   
>   done:


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to