summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLudwig Krispenz <lkrispen@redhat.com>2015-07-01 11:55:13 +0200
committerTomas Babej <tbabej@redhat.com>2015-07-02 11:54:01 +0200
commit6f916b0ac96726eb0219a67f8a06c7df7e59cc86 (patch)
tree8b3cf3c71ff23b5efc186b93c9e3687074733ba2
parent96c23659fcb8adc64dd925556fb40f558fa7e37d (diff)
downloadfreeipa-6f916b0ac96726eb0219a67f8a06c7df7e59cc86.zip
freeipa-6f916b0ac96726eb0219a67f8a06c7df7e59cc86.tar.gz
freeipa-6f916b0ac96726eb0219a67f8a06c7df7e59cc86.tar.xz
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>
-rw-r--r--daemons/ipa-slapi-plugins/topology/topology.h1
-rw-r--r--daemons/ipa-slapi-plugins/topology/topology_pre.c5
-rw-r--r--daemons/ipa-slapi-plugins/topology/topology_util.c11
3 files changed, 17 insertions, 0 deletions
diff --git a/daemons/ipa-slapi-plugins/topology/topology.h b/daemons/ipa-slapi-plugins/topology/topology.h
index 953a5e3..be97376 100644
--- a/daemons/ipa-slapi-plugins/topology/topology.h
+++ b/daemons/ipa-slapi-plugins/topology/topology.h
@@ -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);
diff --git a/daemons/ipa-slapi-plugins/topology/topology_pre.c b/daemons/ipa-slapi-plugins/topology/topology_pre.c
index 0b9f890..952068e 100644
--- a/daemons/ipa-slapi-plugins/topology/topology_pre.c
+++ b/daemons/ipa-slapi-plugins/topology/topology_pre.c
@@ -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;
diff --git a/daemons/ipa-slapi-plugins/topology/topology_util.c b/daemons/ipa-slapi-plugins/topology/topology_util.c
index ea9a9c7..523f612 100644
--- a/daemons/ipa-slapi-plugins/topology/topology_util.c
+++ b/daemons/ipa-slapi-plugins/topology/topology_util.c
@@ -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,