osaf/services/saf/amf/amfd/include/proc.h |   3 ---
 osaf/services/saf/amf/amfd/include/sg.h   |  11 +++++++++--
 osaf/services/saf/amf/amfd/sg.cc          |   8 ++++++++
 osaf/services/saf/amf/amfd/sg_2n_fsm.cc   |  14 +-------------
 osaf/services/saf/amf/amfd/si.cc          |  19 +++++++------------
 5 files changed, 25 insertions(+), 30 deletions(-)


diff --git a/osaf/services/saf/amf/amfd/include/proc.h 
b/osaf/services/saf/amf/amfd/include/proc.h
--- a/osaf/services/saf/amf/amfd/include/proc.h
+++ b/osaf/services/saf/amf/amfd/include/proc.h
@@ -54,7 +54,6 @@ uint32_t avd_sg_su_si_del_snd(AVD_CL_CB 
 
 /* The following are for 2N redundancy model */
 uint32_t avd_sg_2n_su_insvc_func(AVD_CL_CB *cb, AVD_SU *su);
-extern SaAisErrorT avd_sg_2n_siswap_func(AVD_SI *si, SaInvocationT invocation);
 uint32_t avd_sg_2n_su_fault_func(AVD_CL_CB *cb, AVD_SU *su);
 uint32_t avd_sg_2n_susi_sucss_func(AVD_CL_CB *cb, AVD_SU *su, AVD_SU_SI_REL 
*susi,
                                         AVSV_SUSI_ACT act, SaAmfHAStateT 
state);
@@ -67,7 +66,6 @@ void avd_sg_2n_init(AVD_SG *sg);
 /* The following are for N-Way redundancy model */
 uint32_t avd_sg_nway_si_assign(AVD_CL_CB *, AVD_SG *);
 uint32_t avd_sg_nway_su_insvc_func(AVD_CL_CB *cb, AVD_SU *su);
-uint32_t avd_sg_nway_siswitch_func(AVD_CL_CB *cb, AVD_SI *si);
 uint32_t avd_sg_nway_su_fault_func(AVD_CL_CB *cb, AVD_SU *su);
 uint32_t avd_sg_nway_susi_sucss_func(AVD_CL_CB *cb, AVD_SU *su, AVD_SU_SI_REL 
*susi,
                                           AVSV_SUSI_ACT act, SaAmfHAStateT 
state);
@@ -79,7 +77,6 @@ void avd_sg_nway_init(AVD_SG *sg);
 
 /* The following are for N+M redundancy model */
 uint32_t avd_sg_npm_su_insvc_func(AVD_CL_CB *cb, AVD_SU *su);
-uint32_t avd_sg_npm_siswitch_func(AVD_CL_CB *cb, AVD_SI *si);
 uint32_t avd_sg_npm_su_fault_func(AVD_CL_CB *cb, AVD_SU *su);
 uint32_t avd_sg_npm_susi_sucss_func(AVD_CL_CB *cb, AVD_SU *su, AVD_SU_SI_REL 
*susi,
                                          AVSV_SUSI_ACT act, SaAmfHAStateT 
state);
diff --git a/osaf/services/saf/amf/amfd/include/sg.h 
b/osaf/services/saf/amf/amfd/include/sg.h
--- a/osaf/services/saf/amf/amfd/include/sg.h
+++ b/osaf/services/saf/amf/amfd/include/sg.h
@@ -245,8 +245,14 @@ public:
         */
        virtual uint32_t si_admin_down(AVD_CL_CB *cb, AVD_SI *si) = 0;
 
-       // Handle SI admin op SWAP
-       SaAisErrorT (*si_swap)(AVD_SI *si, SaInvocationT invocation);
+       /**
+        * Handle SI admin operation SWAP
+        * Default implementation in base class (not pure virtual)
+        * @param si
+        * @param invocation
+        * @return
+        */
+       virtual SaAisErrorT si_swap(AVD_SI *si, SaInvocationT invocation);
 
        // Handle SG admin op LOCK/SHUTDOWN
        uint32_t (*sg_admin_down)(AVD_CL_CB *cb, AVD_SG *sg);
@@ -287,6 +293,7 @@ public:
        uint32_t realign(AVD_CL_CB *cb, AVD_SG *sg);
        uint32_t si_assign(AVD_CL_CB *cb, AVD_SI *si);
        uint32_t si_admin_down(AVD_CL_CB *cb, AVD_SI *si);
+       SaAisErrorT si_swap(AVD_SI *si, SaInvocationT invocation);
 };
 
 /**
diff --git a/osaf/services/saf/amf/amfd/sg.cc b/osaf/services/saf/amf/amfd/sg.cc
--- a/osaf/services/saf/amf/amfd/sg.cc
+++ b/osaf/services/saf/amf/amfd/sg.cc
@@ -1685,3 +1685,11 @@ uint32_t sg_instantiated_su_count(const 
        return inst_su_count;
 }
 
+// default implementation
+SaAisErrorT AVD_SG::si_swap(AVD_SI *si, SaInvocationT invocation) {
+       saflog(LOG_NOTICE, amfSvcUsrName,
+               "SI SWAP is not supported for redundancy model %u", 
sg_redundancy_model);
+
+       return SA_AIS_ERR_NOT_SUPPORTED;
+}
+
diff --git a/osaf/services/saf/amf/amfd/sg_2n_fsm.cc 
b/osaf/services/saf/amf/amfd/sg_2n_fsm.cc
--- a/osaf/services/saf/amf/amfd/sg_2n_fsm.cc
+++ b/osaf/services/saf/amf/amfd/sg_2n_fsm.cc
@@ -749,18 +749,7 @@ done:
        return NCSCC_RC_SUCCESS;
 }
 
-/**
- * This function is called when a operator does a SI swap admin operation on
- * an SU that belongs to 2N redundancy model SG. The 2N redundancy model 
requires
- * that all SIs assigned to this SU are swapped at the same time.
- * 
- * @param si
- * @param invocation
- * 
- * @return SaAisErrorT
- */
-SaAisErrorT avd_sg_2n_siswap_func(AVD_SI *si, SaInvocationT invocation)
-{
+SaAisErrorT SG_2N::si_swap(AVD_SI *si, SaInvocationT invocation) {
        AVD_SU_SI_REL *susi;
        SaAisErrorT rc = SA_AIS_OK;
         AVD_AVND *node;
@@ -4092,7 +4081,6 @@ AVD_SU *get_other_su_from_oper_list(AVD_
  */
 void avd_sg_2n_init(AVD_SG *sg)
 {
-       sg->si_swap = avd_sg_2n_siswap_func;
        sg->sg_admin_down = avd_sg_2n_sg_admin_down;
        sg->su_insvc = avd_sg_2n_su_insvc_func;
        sg->su_fault = avd_sg_2n_su_fault_func;
diff --git a/osaf/services/saf/amf/amfd/si.cc b/osaf/services/saf/amf/amfd/si.cc
--- a/osaf/services/saf/amf/amfd/si.cc
+++ b/osaf/services/saf/amf/amfd/si.cc
@@ -886,19 +886,14 @@ static void si_admin_op_cb(SaImmOiHandle
                break;
 
        case SA_AMF_ADMIN_SI_SWAP:
-               if (si->sg_of_si->si_swap != NULL) {
-                       rc = si->sg_of_si->si_swap(si, invocation);
-                       if (rc != SA_AIS_OK) {
-                               report_admin_op_error(immOiHandle, invocation, 
SA_AIS_ERR_BAD_OPERATION, NULL,
-                                               "SI Swap of %s failed", 
objectName->value);
-                               goto done;
-                       }
-               } else {
-                       report_admin_op_error(immOiHandle, invocation, 
SA_AIS_ERR_NOT_SUPPORTED, NULL,
-                                       "SI SWAP of %s failed, not supported 
for redundancy model",
-                                       objectName->value);
+               rc = si->sg_of_si->si_swap(si, invocation);
+               if (rc != SA_AIS_OK) {
+                       report_admin_op_error(immOiHandle, invocation,
+                               SA_AIS_ERR_BAD_OPERATION, NULL,
+                               "SI Swap of %s failed", objectName->value);
                        goto done;
-               }
+               } else
+                       ;  // response done later
                break;
 
        case SA_AMF_ADMIN_LOCK_INSTANTIATION:

------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to