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) { + 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