Re: [devel] [PATCH 1/1] amfd: choose unlocked instantiable SU for instantiation [#2462]

2017-09-27 Thread minh chau

Hi Ravi,

ack + legacy tests run.

Just a minor comment before pushing the patch

if (find_instantiable_same_rank_su(i_su))
needs to change to:
if (sg->find_instantiable_same_rank_su(i_su))

Thanks,
Minh

On 26/09/17 14:01, Ravi Sekhar Reddy Konda wrote:

Hi Minh,

Addressed your comments, please find the attached patch(this is on top of the 
original patch).
If you are fine, I will push the patch

Thanks,
Ravi

- Original Message -
From: minh.c...@dektech.com.au
To: ravi.sek...@oracle.com, hans.nordeb...@ericsson.com, gary@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Sent: Wednesday, September 13, 2017 10:36:55 AM GMT +05:30 Chennai, Kolkata, 
Mumbai, New Delhi
Subject: Re: [devel] [PATCH 1/1] amfd: choose unlocked instantiable SU for 
instantiation [#2462]

Hi Ravi,

Minor comments in line.

Thanks,
Minh
On 08/09/17 17:03, Ravi Sekhar wrote:

---
   src/amf/amfd/sgproc.cc | 23 +--
   1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/amf/amfd/sgproc.cc b/src/amf/amfd/sgproc.cc
index 6ca4261..0dbaa59 100644
--- a/src/amf/amfd/sgproc.cc
+++ b/src/amf/amfd/sgproc.cc
@@ -1924,7 +1924,20 @@ uint32_t in_serv_su(AVD_SG *sg) {
 TRACE_LEAVE2("%u", in_serv);
 return in_serv;
   }
-
+/**
+ * @brief   This function checks if there is any same ranked SU
+ *  which is Unlocked and can be Instantiated
+ *
+ * @param   pointer to su
+ *
+ */
+uint32_t find_instantiable_same_rank_su(AVD_SU *su) {
+  for (const auto _su : su->sg_of_su->list_of_su) {
+if (i_su->is_instantiable() && (i_su->saAmfSURank == su->saAmfSURank))
+  return true;
+  }
+  return false;
+}

[Minh]: Returned value of function should be bool, if possible please
consider the new find_instantantiable_same_rank_su() as a method of class.

   
/*
* Function: avd_sg_app_su_inst_func
*
@@ -2011,7 +2024,13 @@ uint32_t avd_sg_app_su_inst_func(AVD_CL_CB *cb, AVD_SG 
*sg) {
   TRACE("%u, %u", sg->pref_inservice_sus(), num_try_insvc_su);
   if (sg->pref_inservice_sus() >
   (sg_instantiated_su_count(i_su->sg_of_su) + num_try_insvc_su)) {
-  /* Try to Instantiate this SU */
+  /* If SU is in Locked State, find if there is any other SU in the 
same rank
+   * which can provide Service(Unlocked SU)
+   */
+  if(i_su->saAmfSUAdminState == SA_AMF_ADMIN_LOCKED) {
+if (find_instantiable_same_rank_su(i_su))
+  continue;
+  }

[Minh]: Patch works fine with reported scenario. However, if replace
"lock SU1, lock SU2" in scenario of ticket by "lock SC1, lock SC2", we
have the same problem - SI is still PARTIALLY_ASSIGNED.
If I change the *if* as below, it works for me in both cases.
if(i_su->is_instantiable() == false) {
  if (find_instantiable_same_rank_su(i_su))
continue;
}

 if (avd_snd_presence_msg(cb, i_su, false) == NCSCC_RC_SUCCESS) {
   num_try_insvc_su++;
 }


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! 
https://urldefense.proofpoint.com/v2/url?u=http-3A__sdm.link_slashdot=DwICAg=RoP1YumCXCgaWHvlZYR8PQcxBKCX5YTpkKY057SbK10=rFCQ76TW5HZUgA7b20ApVcXgXru6mvz4fvCm1_H6w1k=ICtz-8NcHlILP8LBUdTUuikcCD3s8_aYlcsx5gQ_MxI=Ex2RmugAaf80RUUKinucP8YznGguSqRGYzwecTZIdvI=
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.sourceforge.net_lists_listinfo_opensaf-2Ddevel=DwICAg=RoP1YumCXCgaWHvlZYR8PQcxBKCX5YTpkKY057SbK10=rFCQ76TW5HZUgA7b20ApVcXgXru6mvz4fvCm1_H6w1k=ICtz-8NcHlILP8LBUdTUuikcCD3s8_aYlcsx5gQ_MxI=91ManmbaZoIBHsmXK3kReGUsb5EcSNIe3wYPHT8V_VA=



--
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


Re: [devel] [PATCH 1/1] amfd: choose unlocked instantiable SU for instantiation [#2462]

2017-09-25 Thread Ravi Sekhar Reddy Konda
Hi Minh,

Addressed your comments, please find the attached patch(this is on top of the 
original patch).
If you are fine, I will push the patch

Thanks,
Ravi

- Original Message -
From: minh.c...@dektech.com.au
To: ravi.sek...@oracle.com, hans.nordeb...@ericsson.com, gary@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Sent: Wednesday, September 13, 2017 10:36:55 AM GMT +05:30 Chennai, Kolkata, 
Mumbai, New Delhi
Subject: Re: [devel] [PATCH 1/1] amfd: choose unlocked instantiable SU for 
instantiation [#2462]

Hi Ravi,

Minor comments in line.

Thanks,
Minh
On 08/09/17 17:03, Ravi Sekhar wrote:
> ---
>   src/amf/amfd/sgproc.cc | 23 +--
>   1 file changed, 21 insertions(+), 2 deletions(-)
>
> diff --git a/src/amf/amfd/sgproc.cc b/src/amf/amfd/sgproc.cc
> index 6ca4261..0dbaa59 100644
> --- a/src/amf/amfd/sgproc.cc
> +++ b/src/amf/amfd/sgproc.cc
> @@ -1924,7 +1924,20 @@ uint32_t in_serv_su(AVD_SG *sg) {
> TRACE_LEAVE2("%u", in_serv);
> return in_serv;
>   }
> -
> +/**
> + * @brief   This function checks if there is any same ranked SU
> + *  which is Unlocked and can be Instantiated
> + *
> + * @param   pointer to su
> + *
> + */
> +uint32_t find_instantiable_same_rank_su(AVD_SU *su) {
> +  for (const auto _su : su->sg_of_su->list_of_su) {
> +if (i_su->is_instantiable() && (i_su->saAmfSURank == su->saAmfSURank))
> +  return true;
> +  }
> +  return false;
> +}
[Minh]: Returned value of function should be bool, if possible please 
consider the new find_instantantiable_same_rank_su() as a method of class.
>   
> /*
>* Function: avd_sg_app_su_inst_func
>*
> @@ -2011,7 +2024,13 @@ uint32_t avd_sg_app_su_inst_func(AVD_CL_CB *cb, AVD_SG 
> *sg) {
>   TRACE("%u, %u", sg->pref_inservice_sus(), num_try_insvc_su);
>   if (sg->pref_inservice_sus() >
>   (sg_instantiated_su_count(i_su->sg_of_su) + num_try_insvc_su)) {
> -  /* Try to Instantiate this SU */
> +  /* If SU is in Locked State, find if there is any other SU in the 
> same rank
> +   * which can provide Service(Unlocked SU)
> +   */
> +  if(i_su->saAmfSUAdminState == SA_AMF_ADMIN_LOCKED) {
> +if (find_instantiable_same_rank_su(i_su))
> +  continue;
> +  }
[Minh]: Patch works fine with reported scenario. However, if replace 
"lock SU1, lock SU2" in scenario of ticket by "lock SC1, lock SC2", we 
have the same problem - SI is still PARTIALLY_ASSIGNED.
If I change the *if* as below, it works for me in both cases.
   if(i_su->is_instantiable() == false) {
 if (find_instantiable_same_rank_su(i_su))
   continue;
   }
> if (avd_snd_presence_msg(cb, i_su, false) == NCSCC_RC_SUCCESS) {
>   num_try_insvc_su++;
> }


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! 
https://urldefense.proofpoint.com/v2/url?u=http-3A__sdm.link_slashdot=DwICAg=RoP1YumCXCgaWHvlZYR8PQcxBKCX5YTpkKY057SbK10=rFCQ76TW5HZUgA7b20ApVcXgXru6mvz4fvCm1_H6w1k=ICtz-8NcHlILP8LBUdTUuikcCD3s8_aYlcsx5gQ_MxI=Ex2RmugAaf80RUUKinucP8YznGguSqRGYzwecTZIdvI=
 
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.sourceforge.net_lists_listinfo_opensaf-2Ddevel=DwICAg=RoP1YumCXCgaWHvlZYR8PQcxBKCX5YTpkKY057SbK10=rFCQ76TW5HZUgA7b20ApVcXgXru6mvz4fvCm1_H6w1k=ICtz-8NcHlILP8LBUdTUuikcCD3s8_aYlcsx5gQ_MxI=91ManmbaZoIBHsmXK3kReGUsb5EcSNIe3wYPHT8V_VA=
 


amfd_2462_2.patch
Description: Binary data
--
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


Re: [devel] [PATCH 1/1] amfd: choose unlocked instantiable SU for instantiation [#2462]

2017-09-12 Thread minh chau

Hi Ravi,

Minor comments in line.

Thanks,
Minh
On 08/09/17 17:03, Ravi Sekhar wrote:

---
  src/amf/amfd/sgproc.cc | 23 +--
  1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/amf/amfd/sgproc.cc b/src/amf/amfd/sgproc.cc
index 6ca4261..0dbaa59 100644
--- a/src/amf/amfd/sgproc.cc
+++ b/src/amf/amfd/sgproc.cc
@@ -1924,7 +1924,20 @@ uint32_t in_serv_su(AVD_SG *sg) {
TRACE_LEAVE2("%u", in_serv);
return in_serv;
  }
-
+/**
+ * @brief   This function checks if there is any same ranked SU
+ *  which is Unlocked and can be Instantiated
+ *
+ * @param   pointer to su
+ *
+ */
+uint32_t find_instantiable_same_rank_su(AVD_SU *su) {
+  for (const auto _su : su->sg_of_su->list_of_su) {
+if (i_su->is_instantiable() && (i_su->saAmfSURank == su->saAmfSURank))
+  return true;
+  }
+  return false;
+}
[Minh]: Returned value of function should be bool, if possible please 
consider the new find_instantantiable_same_rank_su() as a method of class.

  /*
   * Function: avd_sg_app_su_inst_func
   *
@@ -2011,7 +2024,13 @@ uint32_t avd_sg_app_su_inst_func(AVD_CL_CB *cb, AVD_SG 
*sg) {
  TRACE("%u, %u", sg->pref_inservice_sus(), num_try_insvc_su);
  if (sg->pref_inservice_sus() >
  (sg_instantiated_su_count(i_su->sg_of_su) + num_try_insvc_su)) {
-  /* Try to Instantiate this SU */
+  /* If SU is in Locked State, find if there is any other SU in the 
same rank
+   * which can provide Service(Unlocked SU)
+   */
+  if(i_su->saAmfSUAdminState == SA_AMF_ADMIN_LOCKED) {
+if (find_instantiable_same_rank_su(i_su))
+  continue;
+  }
[Minh]: Patch works fine with reported scenario. However, if replace 
"lock SU1, lock SU2" in scenario of ticket by "lock SC1, lock SC2", we 
have the same problem - SI is still PARTIALLY_ASSIGNED.

If I change the *if* as below, it works for me in both cases.
  if(i_su->is_instantiable() == false) {
if (find_instantiable_same_rank_su(i_su))
  continue;
  }

if (avd_snd_presence_msg(cb, i_su, false) == NCSCC_RC_SUCCESS) {
  num_try_insvc_su++;
}



--
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


[devel] [PATCH 1/1] amfd: choose unlocked instantiable SU for instantiation [#2462]

2017-09-08 Thread Ravi Sekhar
---
 src/amf/amfd/sgproc.cc | 23 +--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/amf/amfd/sgproc.cc b/src/amf/amfd/sgproc.cc
index 6ca4261..0dbaa59 100644
--- a/src/amf/amfd/sgproc.cc
+++ b/src/amf/amfd/sgproc.cc
@@ -1924,7 +1924,20 @@ uint32_t in_serv_su(AVD_SG *sg) {
   TRACE_LEAVE2("%u", in_serv);
   return in_serv;
 }
-
+/**
+ * @brief   This function checks if there is any same ranked SU
+ *  which is Unlocked and can be Instantiated
+ *
+ * @param   pointer to su
+ *
+ */
+uint32_t find_instantiable_same_rank_su(AVD_SU *su) {
+  for (const auto _su : su->sg_of_su->list_of_su) {
+if (i_su->is_instantiable() && (i_su->saAmfSURank == su->saAmfSURank))
+  return true;
+  }
+  return false;
+}
 /*
  * Function: avd_sg_app_su_inst_func
  *
@@ -2011,7 +2024,13 @@ uint32_t avd_sg_app_su_inst_func(AVD_CL_CB *cb, AVD_SG 
*sg) {
 TRACE("%u, %u", sg->pref_inservice_sus(), num_try_insvc_su);
 if (sg->pref_inservice_sus() >
 (sg_instantiated_su_count(i_su->sg_of_su) + num_try_insvc_su)) {
-  /* Try to Instantiate this SU */
+  /* If SU is in Locked State, find if there is any other SU in the 
same rank
+   * which can provide Service(Unlocked SU)
+   */
+  if(i_su->saAmfSUAdminState == SA_AMF_ADMIN_LOCKED) {
+if (find_instantiable_same_rank_su(i_su))
+  continue;
+  }
   if (avd_snd_presence_msg(cb, i_su, false) == NCSCC_RC_SUCCESS) {
 num_try_insvc_su++;
   }
-- 
1.9.1


--
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