Hi Thang,

I mean one CCB with delete both sponsor and dependent CSIs.
Then CCB should be OK, not rejected.

Best Regards,
ThuanTr

------------
Hi Thuan,

I'm not catch up your point. The latest patch I sent is on  2/14/2019.
That solution allow if sponsor csi and dependent csi removed in same CCB.
And the code is in csi_ccb_completed_delete_hdlr(), e.i, delete operation
type.

B.R
/Thang
------------

-----Original Message-----
From: thang.d.nguyen <thang.d.ngu...@dektech.com.au> 
Sent: Thursday, February 14, 2019 4:33 PM
To: gary....@dektech.com.au; minh.c...@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: [devel] [PATCH 1/1] amf: disallow delete csi that another csi is
dependent on [#2969]

Disallow delete a csi that another csi is dependent on. If allowing it
caused AMFD crashed or fallen in cyclic restart.
Allow if csi(s) are deleted in same ccb.
---
 src/amf/amfd/csi.cc | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/src/amf/amfd/csi.cc b/src/amf/amfd/csi.cc index
8282956..c53e62f 100644
--- a/src/amf/amfd/csi.cc
+++ b/src/amf/amfd/csi.cc
@@ -783,6 +783,7 @@ static SaAisErrorT csi_ccb_completed_delete_hdlr(
     CcbUtilOperationData_t *opdata) {
   SaAisErrorT rc = SA_AIS_ERR_BAD_OPERATION;
   AVD_CSI *csi;
+  AVD_CSI *t_csi;
   AVD_SU_SI_REL *t_sisu;
   const std::string object_name(Amf::to_string(&opdata->objectName));
 
@@ -841,6 +842,28 @@ static SaAisErrorT csi_ccb_completed_delete_hdlr(
         }
         t_sisu = t_sisu->si_next;
       } /*  while(t_sisu) */
+
+      // not allow delete if there are csi(s) dependency
+      t_csi = csi->si->list_of_csi;
+      while (t_csi) {
+        AVD_CSI_DEPS *csidep;
+        /* Verify that there are no CSI dependencies to this CSI  */
+        for (csidep = t_csi->saAmfCSIDependencies; csidep != nullptr;
+             csidep = csidep->csi_dep_next) {
+          if (csidep->csi_dep_name_value == csi->name) {
+            SaNameT csidepDn;
+            osaf_extended_name_lend(t_csi->name.c_str(), &csidepDn);
+            if (ccbutil_getCcbOpDataByDN(opdata->ccbId, &csidepDn) ==
nullptr) {
[Thuan] in case of NOT null, we should check operation type is NOT "delete"
to reject this CCB. Because if both CSIs delete in same CCB, it should be
OK.
+              report_ccb_validation_error(
+                      opdata, "csi '%s' depends on  '%s'",
+                      t_csi->name.c_str(), csi->name.c_str());
+              rc = SA_AIS_ERR_BAD_OPERATION;
+              goto done;
+            }
+          }
+        }
+        t_csi = t_csi->si_list_of_csi_next;
+      } /*  while(t_csi) */
     }
   } else {
     if (csi->list_compcsi != nullptr) {
--
2.7.4



_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel



_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to