Hi Lennart,

Reviewed the patch. Following are the comments:

1. Do not use infinite loops like while(true),  In this case while loop 
is not required.
2. comments inline.

Thanks,
Neel.


On 2016/09/22 08:34 PM, Lennart Lund wrote:
>   osaf/services/saf/smfsv/smfd/SmfUpgradeStep.cc |  51 
> ++++++++++++++++---------
>   1 files changed, 33 insertions(+), 18 deletions(-)
>
>
> If a node group for admin operation already exist when create is done the
> existing group shall be deleted so that the new group can be created
>
> diff --git a/osaf/services/saf/smfsv/smfd/SmfUpgradeStep.cc 
> b/osaf/services/saf/smfsv/smfd/SmfUpgradeStep.cc
> --- a/osaf/services/saf/smfsv/smfd/SmfUpgradeStep.cc
> +++ b/osaf/services/saf/smfsv/smfd/SmfUpgradeStep.cc
> @@ -3537,24 +3537,39 @@ bool SmfAdminOperation::createNodeGroup(
>   
>       // ------------------------------------
>       // Create the node group
> -     m_errno = immutil_saImmOmCcbObjectCreate_2(
> -         m_ccbHandle,
> -         className,
> -         &nodeGroupParentDn,
> -         attrValues);
> -
> -     if (m_errno != SA_AIS_OK) {
> -             LOG_NO("%s: saImmOmCcbObjectCreate_2() '%s' Fail %s",
> -                     __FUNCTION__, nGnodeName, saf_error(m_errno));
> -             rc = false;
> -     } else {
> -             m_errno = saImmOmCcbApply(m_ccbHandle);
> -             if (m_errno != SA_AIS_OK) {
> -             LOG_NO("%s: saImmOmCcbApply() Fail '%s'",
> -                     __FUNCTION__, saf_error(m_errno));
> -                     rc = false;
> -             }
> -     }
> +        while (true) {
> +                m_errno = immutil_saImmOmCcbObjectCreate_2(
> +                    m_ccbHandle,
> +                    className,
> +                    &nodeGroupParentDn,
> +                    attrValues);
> +
> +                if (m_errno == SA_AIS_ERR_EXIST) {
> +                        // A node group with the same name already exist
> +                        // May happen if delete after usage has failed
> +                        bool rc = deleteNodeGroup();
> +                        if (rc == false) {
> +                                LOG_NO("%s: deleteNodeGroup() Fail",
> +                                       __FUNCTION__);
> +                                break;
> +                        }
in the else codition, if deleteNodeGroup is true call 
immutil_saImmOmCcbObjectCreate_2. In deleteNodeGroup there are retries 
for deleting.
No need to have while loop,

> +                        continue;
> +                }
> +                if (m_errno != SA_AIS_OK) {
> +                        LOG_NO("%s: saImmOmCcbObjectCreate_2() '%s' Fail %s",
> +                                __FUNCTION__, nGnodeName, 
> saf_error(m_errno));
> +                        rc = false;
> +                        break;
> +                } else {
> +                        m_errno = saImmOmCcbApply(m_ccbHandle);
> +                        if (m_errno != SA_AIS_OK) {
> +                        LOG_NO("%s: saImmOmCcbApply() Fail '%s'",
> +                                __FUNCTION__, saf_error(m_errno));
> +                                rc = false;
> +                        }
> +                        break;
> +                }
> +        }
>   
>       if (nodeName != NULL)
>               free(nodeName);


------------------------------------------------------------------------------
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to