Hi,
        Just to inform you that I have not converted all Error cases in this 
patch. 
For example: 
In file sg_2n_fsm.cc: function avd_sg_2n_susi_fail_func():
    avd_saImmOiAdminOperationResult(cb->immOiHandle, l_susi->si->invocation, 
SA_AIS_ERR_BAD_OPERATION);

Other places like in sgproc.cc : su_complete_admin_op(i_su, SA_AIS_ERR_TIMEOUT);
su_disable_comps(i_su, SA_AIS_ERR_TIMEOUT);

Here we don't have any reason explicit, so response will go as usual.

Any comments ?

Thanks
-Nagu
-----Original Message-----
From: Nagendra Kumar 
Sent: 14 November 2013 17:11
To: hans.fe...@ericsson.com; hans.nordeb...@ericsson.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [devel] [PATCH 1 of 1] amfd: Reject admin op if csi add/remove is in 
progress [#627]

 osaf/services/saf/avsv/avd/avd_csi.c         |  18 ++++++++++++++++++
 osaf/services/saf/avsv/avd/avd_sg.c          |   7 +++++++
 osaf/services/saf/avsv/avd/avd_si.c          |   7 +++++++
 osaf/services/saf/avsv/avd/avd_su.c          |   8 ++++++++
 osaf/services/saf/avsv/avd/include/avd_csi.h |   1 +
 5 files changed, 41 insertions(+), 0 deletions(-)


diff --git a/osaf/services/saf/avsv/avd/avd_csi.c 
b/osaf/services/saf/avsv/avd/avd_csi.c
--- a/osaf/services/saf/avsv/avd/avd_csi.c
+++ b/osaf/services/saf/avsv/avd/avd_csi.c
@@ -1234,3 +1234,21 @@ void avd_csi_constructor(void)
        avd_class_impl_set("SaAmfCSI", NULL, NULL, csi_ccb_completed_cb, 
csi_ccb_apply_cb);  }
 
+/**
+ * @brief      Check whether the Single csi assignment is undergoing on the SG.
+ *
+ * @param[in]  sg - Pointer to the Service Group.
+ *
+ * @return     true if operation is undergoing else false.
+ */
+bool csi_assignment_validate(AVD_SG *sg) {
+       AVD_SI *temp_si;
+       AVD_SU_SI_REL *temp_sisu;
+
+       for (temp_si = sg->list_of_si; temp_si; temp_si = 
temp_si->sg_list_of_si_next)
+               for (temp_sisu = temp_si->list_of_sisu; temp_sisu; temp_sisu = 
temp_sisu->si_next)
+                       if (temp_sisu->csi_add_rem == true)
+                               return true;
+       return false;
+}
diff --git a/osaf/services/saf/avsv/avd/avd_sg.c 
b/osaf/services/saf/avsv/avd/avd_sg.c
--- a/osaf/services/saf/avsv/avd/avd_sg.c
+++ b/osaf/services/saf/avsv/avd/avd_sg.c
@@ -28,6 +28,7 @@
 #include <avd_sg.h>
 #include <avd_proc.h>
 #include <avd_si_dep.h>
+#include <avd_csi.h>
 
 static NCS_PATRICIA_TREE sg_db;
 static void avd_verify_equal_ranked_su(AVD_SG *avd_sg); @@ -1021,6 +1022,12 @@ 
static void sg_admin_op_cb(SaImmOiHandle
                }
        }
 
+        /* Avoid if any single Csi assignment is undergoing on SG. */
+        if (csi_assignment_validate(sg) == true) {
+                rc = SA_AIS_ERR_TRY_AGAIN;
+                LOG_WA("Single Csi assignment undergoing on (sg'%s')", 
sg->name.value);
+                goto done;
+        }
 
        /* if Tolerance timer is running for any SI's withing this SG, then 
return SA_AIS_ERR_TRY_AGAIN */
        if (sg_is_tolerance_timer_running_for_any_si(sg)) { diff --git 
a/osaf/services/saf/avsv/avd/avd_si.c b/osaf/services/saf/avsv/avd/avd_si.c
--- a/osaf/services/saf/avsv/avd/avd_si.c
+++ b/osaf/services/saf/avsv/avd/avd_si.c
@@ -793,6 +793,13 @@ static void si_admin_op_cb(SaImmOiHandle
                 goto done;
         }
 
+        /* Avoid if any single Csi assignment is undergoing on SG. */
+        if (csi_assignment_validate(si->sg_of_si) == true) {
+                rc = SA_AIS_ERR_TRY_AGAIN;
+                LOG_WA("Single Csi assignment undergoing on (sg'%s')", 
si->sg_of_si->name.value);
+                goto done;
+        }
+
        switch (operationId) {
        case SA_AMF_ADMIN_UNLOCK:
                if (SA_AMF_ADMIN_UNLOCKED == si->saAmfSIAdminState) { diff 
--git a/osaf/services/saf/avsv/avd/avd_su.c 
b/osaf/services/saf/avsv/avd/avd_su.c
--- a/osaf/services/saf/avsv/avd/avd_su.c
+++ b/osaf/services/saf/avsv/avd/avd_su.c
@@ -27,6 +27,7 @@
 #include <avd_imm.h>
 #include <avd_ntf.h>
 #include <avd_proc.h>
+#include <avd_csi.h>
 
 static NCS_PATRICIA_TREE su_db;
 
@@ -898,6 +899,13 @@ static void su_admin_op_cb(SaImmOiHandle
                }
        }
 
+       /* Avoid if any single Csi assignment is undergoing on SG. */
+       if (csi_assignment_validate(su->sg_of_su) == true) {
+               rc = SA_AIS_ERR_TRY_AGAIN;
+               LOG_WA("Single Csi assignment undergoing on (sg'%s')", 
su->sg_of_su->name.value);
+               goto done;
+       }
+
        if (su->sg_of_su->sg_fsm_state != AVD_SG_FSM_STABLE) {
                rc = SA_AIS_ERR_TRY_AGAIN;
                LOG_WA("SG state is not stable"); /* whatever that means... */ 
diff --git a/osaf/services/saf/avsv/avd/include/avd_csi.h 
b/osaf/services/saf/avsv/avd/include/avd_csi.h
--- a/osaf/services/saf/avsv/avd/include/avd_csi.h
+++ b/osaf/services/saf/avsv/avd/include/avd_csi.h
@@ -159,5 +159,6 @@ extern void avd_compcsi_from_csi_and_sus  extern void 
avd_csi_delete(struct avd_csi_tag *csi);  extern void csi_cmplt_delete(struct 
avd_csi_tag *csi, SaBoolT ckpt);  extern AVD_CSI *csi_create(const SaNameT 
*csi_name);
+extern bool csi_assignment_validate(struct avd_sg_tag *sg);
 
 #endif

------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps OAuth, 
Users, Roles, SQL, NoSQL, BLOB Storage and External API Access Free app 
hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to