Re: [devel] [PATCH 1 of 1] smf: Fails to create a node group, admin owner/handle is lost [#2153]

2016-11-13 Thread Neelakanta Reddy
Hi Lennart,

Reviewed the patch.
Ack.

/Neel.

On 2016/11/11 09:27 PM, Lennart Lund wrote:
> Hi Neel,
>
> "What is the reason for retrying fro BAD_OPERATION?"
> In order to create a Node Group several handles has to be created. A Failed 
> handle will result in return code BAD_HANDLE
> It is also needed to become admin owner of node group parent. It is also 
> possible that we still have a valid handle but not a valid admin owner. This 
> will result in return code BAD_OPERATION
>
> Thanks
> Lennart
>
>
>> -Original Message-
>> From: Neelakanta Reddy [mailto:reddy.neelaka...@oracle.com]
>> Sent: den 11 november 2016 06:07
>> To: Lennart Lund ; Rafael Odzakow
>> 
>> Cc: opensaf-devel@lists.sourceforge.net
>> Subject: Re: [PATCH 1 of 1] smf: Fails to create a node group, admin
>> owner/handle is lost [#2153]
>>
>> Hi Lennart,
>>
>> comments inline
>>
>> On 2016/11/07 05:42 PM, Lennart Lund wrote:
>>>osaf/services/saf/smfsv/smfd/SmfUpgradeStep.cc |  46
>> +++--
>>>osaf/services/saf/smfsv/smfd/SmfUpgradeStep.hh |   1 +
>>>2 files changed, 36 insertions(+), 11 deletions(-)
>>>
>>>
>>> Recreate handles and admin owner if creating a node group fail
>>>
>>> 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
>>> @@ -2816,6 +2816,17 @@ SmfAdminOperation::SmfAdminOperation(std
>>> m_smfKeepDuState = true;
>>> }
>>>
>>> +   // Create an instance unique name for a node group IMM object
>>> +   // using an instance number.
>>> +   m_instance_number = m_next_instance_number++;
>>> +   m_instanceNodeGroupName =
>> "safAmfNodeGroup=smfLockAdmNg"+
>>> +   std::to_string(m_instance_number);
>>> +   m_admin_owner_name ="smfNgAdmOwnerName";
>>> +   TRACE("%s m_instanceNodeGroupName '%s'",__FUNCTION__,
>>> +   m_instanceNodeGroupName.c_str());
>>> +   TRACE("%s m_NodeGroupAdminOwnerName '%s'",
>> __FUNCTION__,
>>> +   m_admin_owner_name.c_str());
>>> +
>>> // Note:
>>> // If any of the following steps fails m_creation_fail is set to true
>>> // and an immediate return is done
>>> @@ -2835,12 +2846,6 @@ SmfAdminOperation::SmfAdminOperation(std
>>> m_creation_fail = true;
>>> return;
>>> }
>>> -
>>> -   // Create an instance unique name for a node group IMM object
>> using an
>>> -   // instance number.
>>> -   m_instance_number = m_next_instance_number++;
>>> -   m_instanceNodeGroupName =
>> "safAmfNodeGroup=smfLockAdmNg"+
>>> -   std::to_string(m_instance_number);
>>>}
>>>
>>>SmfAdminOperation::~SmfAdminOperation()
>>> @@ -3103,7 +3108,8 @@ bool SmfAdminOperation::initNodeGroupOm(
>>> timeout_try_cnt = 6;
>>> while (timeout_try_cnt > 0) {
>>> ais_rc =
>> immutil_saImmOmAdminOwnerInitialize(m_omHandle,
>>> -   const_cast
>> ("smfSetAdminStateOwner"),
>>> +   const_cast
>>> +   (m_admin_owner_name.c_str()),
>>> SA_TRUE, _ownerHandle);
>>> if (ais_rc != SA_AIS_ERR_TIMEOUT)
>>> break;
>>> @@ -3162,7 +3168,8 @@ bool SmfAdminOperation::becomeAdminOwner
>>> objectNames,
>> SA_IMM_SUBTREE);
>>> bool rc = true;
>>> if (ais_rc != SA_AIS_OK) {
>>> -   LOG_NO("%s: saImmOmAdminOwnerSet Fail '%s'",
>> __FUNCTION__,
>>> +   LOG_NO("%s: saImmOmAdminOwnerSet owner name '%s'
>> Fail '%s'",
>>> +   __FUNCTION__, m_admin_owner_name.c_str(),
>>> saf_error(ais_rc));
>>> }
>>>
>>> @@ -3470,7 +3477,9 @@ bool SmfAdminOperation::createNodeGroup(
>>>{
>>> TRACE_ENTER();
>>>
>>> -   TRACE("\t uniqueNodeName '%s'",
>> m_instanceNodeGroupName.c_str());
>>> +   TRACE("\t unique Node name '%s'",
>> m_instanceNodeGroupName.c_str());
>>> +   TRACE("\t unique Admin owner name '%s'",
>>> +   m_admin_owner_name.c_str());
>>>
>>> // 
>>> // Attribute descriptor for the node name
>>> @@ -3556,7 +3565,7 @@ bool SmfAdminOperation::createNodeGroup(
>>> // Create the node group
>>> m_errno = SA_AIS_OK;
>>> bool method_rc = false;
>>> -const uint32_t MAX_NO_RETRIES = 2;
>>> +const uint32_t MAX_NO_RETRIES = 4;
>>>uint32_t retry_cnt = 0;
>>>while (++retry_cnt <= MAX_NO_RETRIES) {
>>>// Creating the node group object will fail if a 
>>> previously
>>> @@ -3585,7 +3594,22 @@ bool SmfAdminOperation::createNodeGroup(
>>>break;
>>>}
>>>continue;
>>> -} else if (m_errno != 

Re: [devel] [PATCH 1 of 1] smf: Fails to create a node group, admin owner/handle is lost [#2153]

2016-11-11 Thread Lennart Lund
Hi Neel,

"What is the reason for retrying fro BAD_OPERATION?"
In order to create a Node Group several handles has to be created. A Failed 
handle will result in return code BAD_HANDLE
It is also needed to become admin owner of node group parent. It is also 
possible that we still have a valid handle but not a valid admin owner. This 
will result in return code BAD_OPERATION

Thanks
Lennart


> -Original Message-
> From: Neelakanta Reddy [mailto:reddy.neelaka...@oracle.com]
> Sent: den 11 november 2016 06:07
> To: Lennart Lund ; Rafael Odzakow
> 
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: Re: [PATCH 1 of 1] smf: Fails to create a node group, admin
> owner/handle is lost [#2153]
> 
> Hi Lennart,
> 
> comments inline
> 
> On 2016/11/07 05:42 PM, Lennart Lund wrote:
> >   osaf/services/saf/smfsv/smfd/SmfUpgradeStep.cc |  46
> +++--
> >   osaf/services/saf/smfsv/smfd/SmfUpgradeStep.hh |   1 +
> >   2 files changed, 36 insertions(+), 11 deletions(-)
> >
> >
> > Recreate handles and admin owner if creating a node group fail
> >
> > 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
> > @@ -2816,6 +2816,17 @@ SmfAdminOperation::SmfAdminOperation(std
> > m_smfKeepDuState = true;
> > }
> >
> > +   // Create an instance unique name for a node group IMM object
> > +   // using an instance number.
> > +   m_instance_number = m_next_instance_number++;
> > +   m_instanceNodeGroupName =
> "safAmfNodeGroup=smfLockAdmNg"+
> > +   std::to_string(m_instance_number);
> > +   m_admin_owner_name ="smfNgAdmOwnerName";
> > +   TRACE("%s m_instanceNodeGroupName '%s'",__FUNCTION__,
> > +   m_instanceNodeGroupName.c_str());
> > +   TRACE("%s m_NodeGroupAdminOwnerName '%s'",
> __FUNCTION__,
> > +   m_admin_owner_name.c_str());
> > +
> > // Note:
> > // If any of the following steps fails m_creation_fail is set to true
> > // and an immediate return is done
> > @@ -2835,12 +2846,6 @@ SmfAdminOperation::SmfAdminOperation(std
> > m_creation_fail = true;
> > return;
> > }
> > -
> > -   // Create an instance unique name for a node group IMM object
> using an
> > -   // instance number.
> > -   m_instance_number = m_next_instance_number++;
> > -   m_instanceNodeGroupName =
> "safAmfNodeGroup=smfLockAdmNg"+
> > -   std::to_string(m_instance_number);
> >   }
> >
> >   SmfAdminOperation::~SmfAdminOperation()
> > @@ -3103,7 +3108,8 @@ bool SmfAdminOperation::initNodeGroupOm(
> > timeout_try_cnt = 6;
> > while (timeout_try_cnt > 0) {
> > ais_rc =
> immutil_saImmOmAdminOwnerInitialize(m_omHandle,
> > -   const_cast
> ("smfSetAdminStateOwner"),
> > +   const_cast
> > +   (m_admin_owner_name.c_str()),
> > SA_TRUE, _ownerHandle);
> > if (ais_rc != SA_AIS_ERR_TIMEOUT)
> > break;
> > @@ -3162,7 +3168,8 @@ bool SmfAdminOperation::becomeAdminOwner
> > objectNames,
> SA_IMM_SUBTREE);
> > bool rc = true;
> > if (ais_rc != SA_AIS_OK) {
> > -   LOG_NO("%s: saImmOmAdminOwnerSet Fail '%s'",
> __FUNCTION__,
> > +   LOG_NO("%s: saImmOmAdminOwnerSet owner name '%s'
> Fail '%s'",
> > +   __FUNCTION__, m_admin_owner_name.c_str(),
> > saf_error(ais_rc));
> > }
> >
> > @@ -3470,7 +3477,9 @@ bool SmfAdminOperation::createNodeGroup(
> >   {
> > TRACE_ENTER();
> >
> > -   TRACE("\t uniqueNodeName '%s'",
> m_instanceNodeGroupName.c_str());
> > +   TRACE("\t unique Node name '%s'",
> m_instanceNodeGroupName.c_str());
> > +   TRACE("\t unique Admin owner name '%s'",
> > +   m_admin_owner_name.c_str());
> >
> > // 
> > // Attribute descriptor for the node name
> > @@ -3556,7 +3565,7 @@ bool SmfAdminOperation::createNodeGroup(
> > // Create the node group
> > m_errno = SA_AIS_OK;
> > bool method_rc = false;
> > -const uint32_t MAX_NO_RETRIES = 2;
> > +const uint32_t MAX_NO_RETRIES = 4;
> >   uint32_t retry_cnt = 0;
> >   while (++retry_cnt <= MAX_NO_RETRIES) {
> >   // Creating the node group object will fail if a 
> > previously
> > @@ -3585,7 +3594,22 @@ bool SmfAdminOperation::createNodeGroup(
> >   break;
> >   }
> >   continue;
> > -} else if (m_errno != SA_AIS_OK) {
> > +} else if (m_errno == SA_AIS_ERR_BAD_HANDLE ||
> > +  m_errno == SA_AIS_ERR_BAD_OPERATION) {
> What is 

Re: [devel] [PATCH 1 of 1] smf: Fails to create a node group, admin owner/handle is lost [#2153]

2016-11-10 Thread Neelakanta Reddy
Hi Lennart,

comments inline

On 2016/11/07 05:42 PM, Lennart Lund wrote:
>   osaf/services/saf/smfsv/smfd/SmfUpgradeStep.cc |  46 
> +++--
>   osaf/services/saf/smfsv/smfd/SmfUpgradeStep.hh |   1 +
>   2 files changed, 36 insertions(+), 11 deletions(-)
>
>
> Recreate handles and admin owner if creating a node group fail
>
> 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
> @@ -2816,6 +2816,17 @@ SmfAdminOperation::SmfAdminOperation(std
>   m_smfKeepDuState = true;
>   }
>   
> + // Create an instance unique name for a node group IMM object
> + // using an instance number.
> + m_instance_number = m_next_instance_number++;
> + m_instanceNodeGroupName = "safAmfNodeGroup=smfLockAdmNg"+
> + std::to_string(m_instance_number);
> + m_admin_owner_name ="smfNgAdmOwnerName";
> + TRACE("%s m_instanceNodeGroupName '%s'",__FUNCTION__,
> + m_instanceNodeGroupName.c_str());
> + TRACE("%s m_NodeGroupAdminOwnerName '%s'", __FUNCTION__,
> + m_admin_owner_name.c_str());
> +
>   // Note:
>   // If any of the following steps fails m_creation_fail is set to true
>   // and an immediate return is done
> @@ -2835,12 +2846,6 @@ SmfAdminOperation::SmfAdminOperation(std
>   m_creation_fail = true;
>   return;
>   }
> -
> - // Create an instance unique name for a node group IMM object using an
> - // instance number.
> - m_instance_number = m_next_instance_number++;
> - m_instanceNodeGroupName = "safAmfNodeGroup=smfLockAdmNg"+
> - std::to_string(m_instance_number);
>   }
>   
>   SmfAdminOperation::~SmfAdminOperation()
> @@ -3103,7 +3108,8 @@ bool SmfAdminOperation::initNodeGroupOm(
>   timeout_try_cnt = 6;
>   while (timeout_try_cnt > 0) {
>   ais_rc = immutil_saImmOmAdminOwnerInitialize(m_omHandle,
> - const_cast ("smfSetAdminStateOwner"),
> + const_cast
> + (m_admin_owner_name.c_str()),
>   SA_TRUE, _ownerHandle);
>   if (ais_rc != SA_AIS_ERR_TIMEOUT)
>   break;
> @@ -3162,7 +3168,8 @@ bool SmfAdminOperation::becomeAdminOwner
>   objectNames, SA_IMM_SUBTREE);
>   bool rc = true;
>   if (ais_rc != SA_AIS_OK) {
> - LOG_NO("%s: saImmOmAdminOwnerSet Fail '%s'", __FUNCTION__,
> + LOG_NO("%s: saImmOmAdminOwnerSet owner name '%s' Fail '%s'",
> + __FUNCTION__, m_admin_owner_name.c_str(),
>   saf_error(ais_rc));
>   }
>   
> @@ -3470,7 +3477,9 @@ bool SmfAdminOperation::createNodeGroup(
>   {
>   TRACE_ENTER();
>   
> - TRACE("\t uniqueNodeName '%s'", m_instanceNodeGroupName.c_str());
> + TRACE("\t unique Node name '%s'", m_instanceNodeGroupName.c_str());
> + TRACE("\t unique Admin owner name '%s'",
> + m_admin_owner_name.c_str());
>   
>   // 
>   // Attribute descriptor for the node name
> @@ -3556,7 +3565,7 @@ bool SmfAdminOperation::createNodeGroup(
>   // Create the node group
>   m_errno = SA_AIS_OK;
>   bool method_rc = false;
> -const uint32_t MAX_NO_RETRIES = 2;
> +const uint32_t MAX_NO_RETRIES = 4;
>   uint32_t retry_cnt = 0;
>   while (++retry_cnt <= MAX_NO_RETRIES) {
>   // Creating the node group object will fail if a previously
> @@ -3585,7 +3594,22 @@ bool SmfAdminOperation::createNodeGroup(
>   break;
>   }
>   continue;
> -} else if (m_errno != SA_AIS_OK) {
> +} else if (m_errno == SA_AIS_ERR_BAD_HANDLE ||
> +m_errno == SA_AIS_ERR_BAD_OPERATION) {
What is the reason for retrying fro BAD_OPERATION?

Thanks,
Neel.

> +LOG_NO("%s: saImmOmCcbObjectCreate_2 Fail %s",
> +   __FUNCTION__, saf_error(m_errno));
> +finalizeNodeGroupOm();
> +bool rc = initNodeGroupOm();
> +if (rc == false) {
> +LOG_NO("%s: initNodeGroupOm() Fail",
> +   __FUNCTION__);
> +method_rc = false;
> +break;
> +}
> + TRACE("\t Try again after %s",
> + saf_error(m_errno));
> +continue;
> + } else if (m_errno != SA_AIS_OK) {
>   LOG_NO("%s: