- Disallow delete sponsor csi if there is dependent csi.
- Allow delete sponsor csi if it and dependent csi in same ccb.
- Disallow if all csi(s) are deleted in same ccb.
---
src/amf/amfd/csi.cc | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/src/amf/amfd/csi.cc b/src/amf/amfd/csi.cc
index c53e62f..ec5a154 100644
--- a/src/amf/amfd/csi.cc
+++ b/src/amf/amfd/csi.cc
@@ -843,17 +843,42 @@ static SaAisErrorT csi_ccb_completed_delete_hdlr(
t_sisu = t_sisu->si_next;
} /* while(t_sisu) */
+ // not allow delete if all csi(s) deleted in same CCB
+ t_csi = csi->si->list_of_csi;
+ while (t_csi) {
+ CcbUtilOperationData_t *t_opData;
+ SaNameT t_csiDn;
+ osaf_extended_name_lend(t_csi->name.c_str(), &t_csiDn);
+ t_opData = ccbutil_getCcbOpDataByDN(opdata->ccbId, &t_csiDn);
+ if ((t_opData != nullptr) &&
+ (t_opData->operationType == CCBUTIL_DELETE)) {
+ t_csi = t_csi->si_list_of_csi_next;
+ continue;
+ } else {
+ break;
+ }
+ } /* while(t_csi) */
+ if (t_csi == nullptr) {
+ report_ccb_validation_error(
+ opdata, "All csi(s) are deleted in the same CCB");
+ rc = SA_AIS_ERR_BAD_OPERATION;
+ goto done;
+ }
+
// not allow delete if there are csi(s) dependency
t_csi = csi->si->list_of_csi;
while (t_csi) {
AVD_CSI_DEPS *csidep;
+ CcbUtilOperationData_t *t_opData;
/* 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)
{
+ t_opData = ccbutil_getCcbOpDataByDN(opdata->ccbId, &csidepDn);
+ if ((t_opData == nullptr) ||
+ (t_opData->operationType != CCBUTIL_DELETE)) {
report_ccb_validation_error(
opdata, "csi '%s' depends on '%s'",
t_csi->name.c_str(), csi->name.c_str());
--
2.7.4
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel