osaf/services/saf/amf/amfd/nodegroup.cc |  20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)


allow node to be deleted from a nodegroup, even if there are SUs hosted on that 
nodegroup
as long as these SUs are also removed in the same CCB

diff --git a/osaf/services/saf/amf/amfd/nodegroup.cc 
b/osaf/services/saf/amf/amfd/nodegroup.cc
--- a/osaf/services/saf/amf/amfd/nodegroup.cc
+++ b/osaf/services/saf/amf/amfd/nodegroup.cc
@@ -296,6 +296,7 @@
        int add_found = 0;
        int nodes_deleted = 0;
        AVD_AMF_NG *ng;
+       CcbUtilOperationData_t *t_opData;
 
        TRACE_ENTER();
 
@@ -337,21 +338,26 @@
                                /* for all OpenSAF SUs hosted by this node */
                                for (const auto& su : node->list_of_ncs_su) {
                                        if 
(su_is_mapped_to_node_via_nodegroup(su, ng)) {
-                                               
report_ccb_validation_error(opdata, "Cannot delete '%s' from '%s'."
+                                               t_opData = 
ccbutil_getCcbOpDataByDN(opdata->ccbId, &su->name);
+                                               if (t_opData == NULL || 
t_opData->operationType != CCBUTIL_DELETE) {
+                                                       
report_ccb_validation_error(opdata, "Cannot delete '%s' from '%s'."
                                                                " An SU is 
mapped using node group",
                                                                
node->name.value, ng->name.value);
-                                               goto done;
-                                               
+                                                               goto done;
+                                               }
                                        }
                                }
 
                                /* for all application SUs hosted by this node 
*/
                                for (const auto& su : node->list_of_su) {
                                        if 
(su_is_mapped_to_node_via_nodegroup(su, ng)) {
-                                               
report_ccb_validation_error(opdata, "Cannot delete '%s' from '%s'."
-                                                               " An SU is 
mapped using node group",
-                                                               
node->name.value, ng->name.value);
-                                               goto done;
+                                               t_opData = 
ccbutil_getCcbOpDataByDN(opdata->ccbId, &su->name);
+                                               if (t_opData == NULL || 
t_opData->operationType != CCBUTIL_DELETE) {
+                                                       
report_ccb_validation_error(opdata, "Cannot delete '%s' from '%s'."
+                                                       " An SU is mapped using 
node group",
+                                                       node->name.value, 
ng->name.value);
+                                                       goto done;
+                                               }
                                        }
                                }
                                

------------------------------------------------------------------------------
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to