allow deletion of segment if endpoint is not managed

in the preop check do not reject the deletion of a segment, if not both endpoints
are managed servers for the suffix

thisis part of work for ticlet #5072

Reviewed-By: Simo Sorce <ssorce@redhat.com>
This commit is contained in:
Ludwig Krispenz authored and Tomas Babej committed 2015-07-02 11:54:01 +02:00
1 parent 96c23659fc
commit 6f916b0ac9
3 files changed
+17

No files matched your search

@@ -283,6 +283,7 @@ void ipa_topo_util_delete_segments_for_host(char *repl_root, char *delhost);
int ipa_topo_util_entry_is_candidate(Slapi_Entry *e);
int ipa_topo_util_target_is_managed(Slapi_Entry *e);
int ipa_topo_util_segment_is_managed(TopoReplica *tconf, TopoReplicaSegment *tsegm);
char * ipa_topo_util_get_segm_attr(TopoReplicaAgmt *agmt, char *attr_type);
void ipa_topo_util_set_segm_attr(TopoReplicaAgmt *agmt, char *attr_type,
char *attr_val);
@@ -406,6 +406,11 @@ ipa_topo_check_topology_disconnect(Slapi_PBlock *pb)
"segment to be deleted does not exist\n");
goto done;
}
if (!ipa_topo_util_segment_is_managed(tconf,tsegm)) {
/* not both endpoints are managed servers, delete is ok */
rc = 0;
goto done;
}
/* check if removal of segment would break connectivity */
fanout = ipa_topo_connection_fanout(tconf, tsegm);
if (fanout == NULL) goto done;
@@ -1036,6 +1036,17 @@ ipa_topo_util_target_is_managed(Slapi_Entry *e)
}
int ipa_topo_util_segment_is_managed(TopoReplica *tconf, TopoReplicaSegment *tsegm)
{
int ret = 0;
if (ipa_topo_cfg_host_find(tconf, tsegm->from, 1) &&
ipa_topo_cfg_host_find(tconf, tsegm->to, 1)) {
ret = 1;
}
return ret;
}
void
ipa_topo_util_segm_update (TopoReplica *tconf,
TopoReplicaSegment *tsegm,