[devel] [PATCH 1 of 1] amfd: validate node for being nodegroup member [#1311]

2015-04-22 Thread nagendra . k
 osaf/services/saf/amf/amfd/node.cc |  14 ++
 1 files changed, 14 insertions(+), 0 deletions(-)


Amfd is allowing node to be deleted even if node is being part of node group.
This creates database differences because that node is still part of node group,
but it doesn's exists.
When a nodegroup is created and node is added to it, Amfd checks whether
node exists or not. If it doesn't exist, then node addition fails.
This is done in the expectation that node should exists if it want to
be part of node group. This concept should go inline with deletion of node
as well and node deletion shouldn't be allowed until it is part of a nodegroup.

A valiadation has been added when node is being deleted for its membership
of a node group. If node is a part of membership, it can't be deleted. So,
to delete a node, first delete that node from node group.

diff --git a/osaf/services/saf/amf/amfd/node.cc 
b/osaf/services/saf/amf/amfd/node.cc
--- a/osaf/services/saf/amf/amfd/node.cc
+++ b/osaf/services/saf/amf/amfd/node.cc
@@ -453,6 +453,20 @@ static SaAisErrorT node_ccb_completed_de
goto done;
}
}
+
+   /* This node shouldn't be part of any nodegroup. First this node has to 
be deleted from
+  node group. */
+   for (std::map::const_iterator it = 
nodegroup_db->begin();
+   it != nodegroup_db->end(); it++) {
+   AVD_AMF_NG *ng = it->second;
+   if (node_in_nodegroup(Amf::to_string(&(opdata->objectName)), 
ng) == true) {
+   report_ccb_validation_error(opdata, "'%s' exists in"
+   " the nodegroup '%s'",
+   opdata->objectName.value, 
ng->name.value);
+   rc = SA_AIS_ERR_BAD_OPERATION;
+   goto done;
+   }
+   }
opdata->userData = node;
 done:
TRACE_LEAVE();

--
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfd: validate node for being nodegroup member [#1311]

2015-04-23 Thread Hans Nordebäck
ack, code review only/Thanks HansN

On 04/22/2015 01:27 PM, nagendr...@oracle.com wrote:
>   osaf/services/saf/amf/amfd/node.cc |  14 ++
>   1 files changed, 14 insertions(+), 0 deletions(-)
>
>
> Amfd is allowing node to be deleted even if node is being part of node group.
> This creates database differences because that node is still part of node 
> group,
> but it doesn's exists.
> When a nodegroup is created and node is added to it, Amfd checks whether
> node exists or not. If it doesn't exist, then node addition fails.
> This is done in the expectation that node should exists if it want to
> be part of node group. This concept should go inline with deletion of node
> as well and node deletion shouldn't be allowed until it is part of a 
> nodegroup.
>
> A valiadation has been added when node is being deleted for its membership
> of a node group. If node is a part of membership, it can't be deleted. So,
> to delete a node, first delete that node from node group.
>
> diff --git a/osaf/services/saf/amf/amfd/node.cc 
> b/osaf/services/saf/amf/amfd/node.cc
> --- a/osaf/services/saf/amf/amfd/node.cc
> +++ b/osaf/services/saf/amf/amfd/node.cc
> @@ -453,6 +453,20 @@ static SaAisErrorT node_ccb_completed_de
>   goto done;
>   }
>   }
> +
> + /* This node shouldn't be part of any nodegroup. First this node has to 
> be deleted from
> +node group. */
> + for (std::map::const_iterator it = 
> nodegroup_db->begin();
> + it != nodegroup_db->end(); it++) {
> + AVD_AMF_NG *ng = it->second;
> + if (node_in_nodegroup(Amf::to_string(&(opdata->objectName)), 
> ng) == true) {
> + report_ccb_validation_error(opdata, "'%s' exists in"
> + " the nodegroup '%s'",
> + opdata->objectName.value, 
> ng->name.value);
> + rc = SA_AIS_ERR_BAD_OPERATION;
> + goto done;
> + }
> + }
>   opdata->userData = node;
>   done:
>   TRACE_LEAVE();

--
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel