Re: [Freeipa-devel] [PATCH 0019] handle cleanRUV in the topology plugin

2015-10-26 Thread Mark Reynolds



On 10/23/2015 06:39 AM, Ludwig Krispenz wrote:


On 10/23/2015 11:24 AM, thierry bordaz wrote:

On 10/23/2015 11:00 AM, thierry bordaz wrote:

On 10/12/2015 01:17 PM, Ludwig Krispenz wrote:


On 10/12/2015 12:44 PM, Martin Basti wrote:



On 23.07.2015 10:46, Ludwig Krispenz wrote:
The attached patch moves the cleaning of the RUV into the 
topology plugin.


I encountered a problem when removing a replica, which 
disconnects the topology, but it was fixed with my WIP for #5072.


I want to keep these issues separate, so please review and test 
the patch and let me know about issues found


Ludwig




Is this patch still valid and pending review?
it should be  still valid, waiting for review, wanted to rebase 
after topology/promotion patches have been checked in and resend





Hello Ludwig,

The patch looks good. I have few minor remarks:

  * Are the hostname in ruv always fqdn ? to retrieve the RUV
element of a given host you use 'strstr'.
If you have host vm-11 and vm-112, I wonder if it could pickup
the wrong RUV element
  * In ipa_topo_util_cleanruv_element you need a pblock_done/free
(or destroy)
  * In it fails to add the clearn-ruv task, you should log a message
so that the admin knows what to do.

thanks
thierry




Hi Ludwig,


I will adress the points raised, thank you
Additional question. cleanruv is done with 'replica-force-cleaning: 
yes'. Currently ipa-replica-manage does not implement this flag.

Why do you use it in topology plugin.

there are two potential problems with the cleanallruv task:
1] the rid could come back if not all servers were in sync,  but with 
cleaning the changelog as part of cleanallruv I think the ris is low now
2] the cleanallruv is stuck on waiting for the task to complete on 
other servers even if they cannot be reached
The fix/rfe to cleanallruv that allows the force option to skip the 
online replica checks(https://fedorahosted.org/389/ticket/48218) has not 
been pushed yet.  Currently its set for 1.3.5.


FYI,
Mark


I want to avoid 2] therefore I choose this setting
My concern is that if we delete a host before all the updates from 
that host has been received, could we receive a late update that will 
recreate the ruv element ?


thanks
thierry






-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Re: [Freeipa-devel] [PATCH 0019] handle cleanRUV in the topology plugin

2015-10-26 Thread Martin Basti



On 23.10.2015 15:34, thierry bordaz wrote:

On 10/23/2015 03:38 PM, Ludwig Krispenz wrote:


On 10/23/2015 03:19 PM, thierry bordaz wrote:

Hi Ludwig,

Thanks for the patch.
Yes it is looking good to me. Just a minor change about the message 
logged (if case of failure to add the cleanallruv task), you may 
recommend to the administrator the exact command to run.
no, also we do not know why it failed, there would be the option to 
do it via ipa-replica-manage or ldapmodify, the logging that creating 
the task failed should be be enough to start investigation and do a 
manual cleanallruv


Ok. I agree. Thanks


ACK

thanks
thierry
On 10/23/2015 02:27 PM, Ludwig Krispenz wrote:

Hi Thierry,

hope this addresses your concerns

Ludwig

On 10/23/2015 11:24 AM, thierry bordaz wrote:

On 10/23/2015 11:00 AM, thierry bordaz wrote:

On 10/12/2015 01:17 PM, Ludwig Krispenz wrote:


On 10/12/2015 12:44 PM, Martin Basti wrote:



On 23.07.2015 10:46, Ludwig Krispenz wrote:
The attached patch moves the cleaning of the RUV into the 
topology plugin.


I encountered a problem when removing a replica, which 
disconnects the topology, but it was fixed with my WIP for #5072.


I want to keep these issues separate, so please review and 
test the patch and let me know about issues found


Ludwig




Is this patch still valid and pending review?
it should be  still valid, waiting for review, wanted to rebase 
after topology/promotion patches have been checked in and resend





Hello Ludwig,

The patch looks good. I have few minor remarks:

  * Are the hostname in ruv always fqdn ? to retrieve the RUV
element of a given host you use 'strstr'.
If you have host vm-11 and vm-112, I wonder if it could
pickup the wrong RUV element
  * In ipa_topo_util_cleanruv_element you need a pblock_done/free
(or destroy)
  * In it fails to add the clearn-ruv task, you should log a
message so that the admin knows what to do.

thanks
thierry




Hi Ludwig,

Additional question. cleanruv is done with 
'replica-force-cleaning: yes'. Currently ipa-replica-manage does 
not implement this flag.

Why do you use it in topology plugin.
My concern is that if we delete a host before all the updates from 
that host has been received, could we receive a late update that 
will recreate the ruv element ?


thanks
thierry











Pushed to master: 26bfc914d97f8698f294967e9812b0a7ebc4bce6
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Re: [Freeipa-devel] [PATCH 0019] handle cleanRUV in the topology plugin

2015-10-23 Thread thierry bordaz

On 10/23/2015 03:38 PM, Ludwig Krispenz wrote:


On 10/23/2015 03:19 PM, thierry bordaz wrote:

Hi Ludwig,

Thanks for the patch.
Yes it is looking good to me. Just a minor change about the message 
logged (if case of failure to add the cleanallruv task), you may 
recommend to the administrator the exact command to run.
no, also we do not know why it failed, there would be the option to do 
it via ipa-replica-manage or ldapmodify, the logging that creating the 
task failed should be be enough to start investigation and do a manual 
cleanallruv


Ok. I agree. Thanks


ACK

thanks
thierry
On 10/23/2015 02:27 PM, Ludwig Krispenz wrote:

Hi Thierry,

hope this addresses your concerns

Ludwig

On 10/23/2015 11:24 AM, thierry bordaz wrote:

On 10/23/2015 11:00 AM, thierry bordaz wrote:

On 10/12/2015 01:17 PM, Ludwig Krispenz wrote:


On 10/12/2015 12:44 PM, Martin Basti wrote:



On 23.07.2015 10:46, Ludwig Krispenz wrote:
The attached patch moves the cleaning of the RUV into the 
topology plugin.


I encountered a problem when removing a replica, which 
disconnects the topology, but it was fixed with my WIP for #5072.


I want to keep these issues separate, so please review and test 
the patch and let me know about issues found


Ludwig




Is this patch still valid and pending review?
it should be  still valid, waiting for review, wanted to rebase 
after topology/promotion patches have been checked in and resend





Hello Ludwig,

The patch looks good. I have few minor remarks:

  * Are the hostname in ruv always fqdn ? to retrieve the RUV
element of a given host you use 'strstr'.
If you have host vm-11 and vm-112, I wonder if it could pickup
the wrong RUV element
  * In ipa_topo_util_cleanruv_element you need a pblock_done/free
(or destroy)
  * In it fails to add the clearn-ruv task, you should log a
message so that the admin knows what to do.

thanks
thierry




Hi Ludwig,

Additional question. cleanruv is done with 'replica-force-cleaning: 
yes'. Currently ipa-replica-manage does not implement this flag.

Why do you use it in topology plugin.
My concern is that if we delete a host before all the updates from 
that host has been received, could we receive a late update that 
will recreate the ruv element ?


thanks
thierry








-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Re: [Freeipa-devel] [PATCH 0019] handle cleanRUV in the topology plugin

2015-10-23 Thread Ludwig Krispenz


On 10/23/2015 03:19 PM, thierry bordaz wrote:

Hi Ludwig,

Thanks for the patch.
Yes it is looking good to me. Just a minor change about the message 
logged (if case of failure to add the cleanallruv task), you may 
recommend to the administrator the exact command to run.
no, also we do not know why it failed, there would be the option to do 
it via ipa-replica-manage or ldapmodify, the logging that creating the 
task failed should be be enough to start investigation and do a manual 
cleanallruv


ACK

thanks
thierry
On 10/23/2015 02:27 PM, Ludwig Krispenz wrote:

Hi Thierry,

hope this addresses your concerns

Ludwig

On 10/23/2015 11:24 AM, thierry bordaz wrote:

On 10/23/2015 11:00 AM, thierry bordaz wrote:

On 10/12/2015 01:17 PM, Ludwig Krispenz wrote:


On 10/12/2015 12:44 PM, Martin Basti wrote:



On 23.07.2015 10:46, Ludwig Krispenz wrote:
The attached patch moves the cleaning of the RUV into the 
topology plugin.


I encountered a problem when removing a replica, which 
disconnects the topology, but it was fixed with my WIP for #5072.


I want to keep these issues separate, so please review and test 
the patch and let me know about issues found


Ludwig




Is this patch still valid and pending review?
it should be  still valid, waiting for review, wanted to rebase 
after topology/promotion patches have been checked in and resend





Hello Ludwig,

The patch looks good. I have few minor remarks:

  * Are the hostname in ruv always fqdn ? to retrieve the RUV
element of a given host you use 'strstr'.
If you have host vm-11 and vm-112, I wonder if it could pickup
the wrong RUV element
  * In ipa_topo_util_cleanruv_element you need a pblock_done/free
(or destroy)
  * In it fails to add the clearn-ruv task, you should log a
message so that the admin knows what to do.

thanks
thierry




Hi Ludwig,

Additional question. cleanruv is done with 'replica-force-cleaning: 
yes'. Currently ipa-replica-manage does not implement this flag.

Why do you use it in topology plugin.
My concern is that if we delete a host before all the updates from 
that host has been received, could we receive a late update that 
will recreate the ruv element ?


thanks
thierry






-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Re: [Freeipa-devel] [PATCH 0019] handle cleanRUV in the topology plugin

2015-10-23 Thread thierry bordaz

Hi Ludwig,

Thanks for the patch.
Yes it is looking good to me. Just a minor change about the message 
logged (if case of failure to add the cleanallruv task), you may 
recommend to the administrator the exact command to run.


ACK

thanks
thierry
On 10/23/2015 02:27 PM, Ludwig Krispenz wrote:

Hi Thierry,

hope this addresses your concerns

Ludwig

On 10/23/2015 11:24 AM, thierry bordaz wrote:

On 10/23/2015 11:00 AM, thierry bordaz wrote:

On 10/12/2015 01:17 PM, Ludwig Krispenz wrote:


On 10/12/2015 12:44 PM, Martin Basti wrote:



On 23.07.2015 10:46, Ludwig Krispenz wrote:
The attached patch moves the cleaning of the RUV into the 
topology plugin.


I encountered a problem when removing a replica, which 
disconnects the topology, but it was fixed with my WIP for #5072.


I want to keep these issues separate, so please review and test 
the patch and let me know about issues found


Ludwig




Is this patch still valid and pending review?
it should be  still valid, waiting for review, wanted to rebase 
after topology/promotion patches have been checked in and resend





Hello Ludwig,

The patch looks good. I have few minor remarks:

  * Are the hostname in ruv always fqdn ? to retrieve the RUV
element of a given host you use 'strstr'.
If you have host vm-11 and vm-112, I wonder if it could pickup
the wrong RUV element
  * In ipa_topo_util_cleanruv_element you need a pblock_done/free
(or destroy)
  * In it fails to add the clearn-ruv task, you should log a message
so that the admin knows what to do.

thanks
thierry




Hi Ludwig,

Additional question. cleanruv is done with 'replica-force-cleaning: 
yes'. Currently ipa-replica-manage does not implement this flag.

Why do you use it in topology plugin.
My concern is that if we delete a host before all the updates from 
that host has been received, could we receive a late update that will 
recreate the ruv element ?


thanks
thierry




-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Re: [Freeipa-devel] [PATCH 0019] handle cleanRUV in the topology plugin

2015-10-23 Thread Ludwig Krispenz

Hi Thierry,

hope this addresses your concerns

Ludwig

On 10/23/2015 11:24 AM, thierry bordaz wrote:

On 10/23/2015 11:00 AM, thierry bordaz wrote:

On 10/12/2015 01:17 PM, Ludwig Krispenz wrote:


On 10/12/2015 12:44 PM, Martin Basti wrote:



On 23.07.2015 10:46, Ludwig Krispenz wrote:
The attached patch moves the cleaning of the RUV into the topology 
plugin.


I encountered a problem when removing a replica, which disconnects 
the topology, but it was fixed with my WIP for #5072.


I want to keep these issues separate, so please review and test 
the patch and let me know about issues found


Ludwig




Is this patch still valid and pending review?
it should be  still valid, waiting for review, wanted to rebase 
after topology/promotion patches have been checked in and resend





Hello Ludwig,

The patch looks good. I have few minor remarks:

  * Are the hostname in ruv always fqdn ? to retrieve the RUV element
of a given host you use 'strstr'.
If you have host vm-11 and vm-112, I wonder if it could pickup
the wrong RUV element
  * In ipa_topo_util_cleanruv_element you need a pblock_done/free (or
destroy)
  * In it fails to add the clearn-ruv task, you should log a message
so that the admin knows what to do.

thanks
thierry




Hi Ludwig,

Additional question. cleanruv is done with 'replica-force-cleaning: 
yes'. Currently ipa-replica-manage does not implement this flag.

Why do you use it in topology plugin.
My concern is that if we delete a host before all the updates from 
that host has been received, could we receive a late update that will 
recreate the ruv element ?


thanks
thierry


>From d97bf45987225521b9f047071ff065e994c78b94 Mon Sep 17 00:00:00 2001
From: Ludwig Krispenz 
Date: Fri, 23 Oct 2015 14:18:48 +0200
Subject: [PATCH] handle cleaning of RUV in the topology plugin

After removing a server the replicaid needs to be cleared in the ruv entry and
in the changelog.
This was triggere by initiating a cleanallruv task in "ipa-replica-manage del",
but the removal of a master already triggers a cleanup of segments and replication
agreement by the topology plugin, so this could be handled by the plugin as well.
---
 daemons/ipa-slapi-plugins/topology/topology.h  |   1 +
 daemons/ipa-slapi-plugins/topology/topology_post.c |   1 +
 daemons/ipa-slapi-plugins/topology/topology_util.c | 104 +
 install/tools/ipa-replica-manage   |   7 +-
 4 files changed, 107 insertions(+), 6 deletions(-)

diff --git a/daemons/ipa-slapi-plugins/topology/topology.h b/daemons/ipa-slapi-plugins/topology/topology.h
index 1332c7bc76e4f4b091cbb691c8b61d8d9fee5d83..fea8281ac5f0865aca4052f6139e4384f5665b87 100644
--- a/daemons/ipa-slapi-plugins/topology/topology.h
+++ b/daemons/ipa-slapi-plugins/topology/topology.h
@@ -286,6 +286,7 @@ void ipa_topo_util_disable_repl_for_principal(char *repl_root, char *principal);
 void ipa_topo_util_add_host(Slapi_Entry *hostentry);
 void ipa_topo_util_delete_host(Slapi_Entry *hostentry);
 void ipa_topo_util_update_host(Slapi_Entry *hostentry, LDAPMod **mods);
+void ipa_topo_util_cleanruv(Slapi_Entry *hostentry);
 void ipa_topo_util_disable_repl_from_host(char *repl_root, char *delhost);
 void ipa_topo_util_delete_segments_for_host(char *repl_root, char *delhost);
 
diff --git a/daemons/ipa-slapi-plugins/topology/topology_post.c b/daemons/ipa-slapi-plugins/topology/topology_post.c
index c20de3cbe27c022a48da298d913ab795c883e954..5ac029a86a2f8ffbda895c5fe2a1af4c45152832 100644
--- a/daemons/ipa-slapi-plugins/topology/topology_post.c
+++ b/daemons/ipa-slapi-plugins/topology/topology_post.c
@@ -276,6 +276,7 @@ ipa_topo_post_del(Slapi_PBlock *pb)
  */
 ipa_topo_util_delete_host(del_entry);
 ipa_topo_cfg_host_del(del_entry);
+ipa_topo_util_cleanruv(del_entry);
 break;
 case TOPO_IGNORE_ENTRY:
 break;
diff --git a/daemons/ipa-slapi-plugins/topology/topology_util.c b/daemons/ipa-slapi-plugins/topology/topology_util.c
index 26f569c5186688c5336bee077efbf2fc1dddbfee..6019f0fd05c7dc7a44afacd0878288b13dc3e57f 100644
--- a/daemons/ipa-slapi-plugins/topology/topology_util.c
+++ b/daemons/ipa-slapi-plugins/topology/topology_util.c
@@ -1779,3 +1779,107 @@ ipa_topo_util_is_tombstone_op(Slapi_PBlock *pb)
 slapi_pblock_get(pb, SLAPI_OPERATION, &op);
 return slapi_operation_is_flag_set(op, SLAPI_OP_FLAG_TOMBSTONE_ENTRY);
 }
+int
+ipa_topo_util_cleanruv_task(char *repl_root, int replicaID)
+{
+Slapi_Entry *e = NULL;
+Slapi_PBlock *pb;
+char *dn = NULL;
+char *repl_rid;
+Slapi_DN *sdn = NULL;
+int ret = 0;
+dn = slapi_ch_smprintf("cn=clean %d,cn=cleanallruv,cn=tasks,cn=config", replicaID);
+if (dn  == NULL) return -1;
+sdn = slapi_sdn_new_normdn_byref(dn);
+
+e = slapi_entry_alloc();
+/* the entry now owns the dup'd dn */
+slapi_entry_init_ext(e, sdn, NULL); /* sdn is copied into e */
+slapi_sdn_free(&sdn);
+
+slapi_en

Re: [Freeipa-devel] [PATCH 0019] handle cleanRUV in the topology plugin

2015-10-23 Thread Petr Vobornik

On 10/23/2015 12:38 PM, thierry bordaz wrote:

On 10/23/2015 12:39 PM, Ludwig Krispenz wrote:


On 10/23/2015 11:24 AM, thierry bordaz wrote:

On 10/23/2015 11:00 AM, thierry bordaz wrote:

On 10/12/2015 01:17 PM, Ludwig Krispenz wrote:


On 10/12/2015 12:44 PM, Martin Basti wrote:



On 23.07.2015 10:46, Ludwig Krispenz wrote:

The attached patch moves the cleaning of the RUV into the
topology plugin.

I encountered a problem when removing a replica, which
disconnects the topology, but it was fixed with my WIP for #5072.

I want to keep these issues separate, so please review and test
the patch and let me know about issues found

Ludwig




Is this patch still valid and pending review?

it should be  still valid, waiting for review, wanted to rebase
after topology/promotion patches have been checked in and resend




Hello Ludwig,

The patch looks good. I have few minor remarks:

  * Are the hostname in ruv always fqdn ? to retrieve the RUV
element of a given host you use 'strstr'.
If you have host vm-11 and vm-112, I wonder if it could pickup
the wrong RUV element
  * In ipa_topo_util_cleanruv_element you need a pblock_done/free
(or destroy)
  * In it fails to add the clearn-ruv task, you should log a message
so that the admin knows what to do.

thanks
thierry




Hi Ludwig,


I will adress the points raised, thank you

Additional question. cleanruv is done with 'replica-force-cleaning:
yes'. Currently ipa-replica-manage does not implement this flag.
Why do you use it in topology plugin.

there are two potential problems with the cleanallruv task:
1] the rid could come back if not all servers were in sync,  but with
cleaning the changelog as part of cleanallruv I think the ris is low now
2] the cleanallruv is stuck on waiting for the task to complete on
other servers even if they cannot be reached

I want to avoid 2] therefore I choose this setting


Oh yes I absolutely agree.
What surprised me is that I thought IPA CLI already implemented that
flag in cleanRUV. But I was wrong.


Could you please open a bug for ipa-replica-manage, with description of 
what and when should be added?




thanks
thierry

My concern is that if we delete a host before all the updates from
that host has been received, could we receive a late update that will
recreate the ruv element ?

thanks
thierry




--
Petr Vobornik

--
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code


Re: [Freeipa-devel] [PATCH 0019] handle cleanRUV in the topology plugin

2015-10-23 Thread thierry bordaz

On 10/23/2015 12:39 PM, Ludwig Krispenz wrote:


On 10/23/2015 11:24 AM, thierry bordaz wrote:

On 10/23/2015 11:00 AM, thierry bordaz wrote:

On 10/12/2015 01:17 PM, Ludwig Krispenz wrote:


On 10/12/2015 12:44 PM, Martin Basti wrote:



On 23.07.2015 10:46, Ludwig Krispenz wrote:
The attached patch moves the cleaning of the RUV into the 
topology plugin.


I encountered a problem when removing a replica, which 
disconnects the topology, but it was fixed with my WIP for #5072.


I want to keep these issues separate, so please review and test 
the patch and let me know about issues found


Ludwig




Is this patch still valid and pending review?
it should be  still valid, waiting for review, wanted to rebase 
after topology/promotion patches have been checked in and resend





Hello Ludwig,

The patch looks good. I have few minor remarks:

  * Are the hostname in ruv always fqdn ? to retrieve the RUV
element of a given host you use 'strstr'.
If you have host vm-11 and vm-112, I wonder if it could pickup
the wrong RUV element
  * In ipa_topo_util_cleanruv_element you need a pblock_done/free
(or destroy)
  * In it fails to add the clearn-ruv task, you should log a message
so that the admin knows what to do.

thanks
thierry




Hi Ludwig,


I will adress the points raised, thank you
Additional question. cleanruv is done with 'replica-force-cleaning: 
yes'. Currently ipa-replica-manage does not implement this flag.

Why do you use it in topology plugin.

there are two potential problems with the cleanallruv task:
1] the rid could come back if not all servers were in sync,  but with 
cleaning the changelog as part of cleanallruv I think the ris is low now
2] the cleanallruv is stuck on waiting for the task to complete on 
other servers even if they cannot be reached


I want to avoid 2] therefore I choose this setting


Oh yes I absolutely agree.
What surprised me is that I thought IPA CLI already implemented that 
flag in cleanRUV. But I was wrong.


thanks
thierry
My concern is that if we delete a host before all the updates from 
that host has been received, could we receive a late update that will 
recreate the ruv element ?


thanks
thierry




-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Re: [Freeipa-devel] [PATCH 0019] handle cleanRUV in the topology plugin

2015-10-23 Thread Ludwig Krispenz


On 10/23/2015 11:24 AM, thierry bordaz wrote:

On 10/23/2015 11:00 AM, thierry bordaz wrote:

On 10/12/2015 01:17 PM, Ludwig Krispenz wrote:


On 10/12/2015 12:44 PM, Martin Basti wrote:



On 23.07.2015 10:46, Ludwig Krispenz wrote:
The attached patch moves the cleaning of the RUV into the topology 
plugin.


I encountered a problem when removing a replica, which disconnects 
the topology, but it was fixed with my WIP for #5072.


I want to keep these issues separate, so please review and test 
the patch and let me know about issues found


Ludwig




Is this patch still valid and pending review?
it should be  still valid, waiting for review, wanted to rebase 
after topology/promotion patches have been checked in and resend





Hello Ludwig,

The patch looks good. I have few minor remarks:

  * Are the hostname in ruv always fqdn ? to retrieve the RUV element
of a given host you use 'strstr'.
If you have host vm-11 and vm-112, I wonder if it could pickup
the wrong RUV element
  * In ipa_topo_util_cleanruv_element you need a pblock_done/free (or
destroy)
  * In it fails to add the clearn-ruv task, you should log a message
so that the admin knows what to do.

thanks
thierry




Hi Ludwig,


I will adress the points raised, thank you
Additional question. cleanruv is done with 'replica-force-cleaning: 
yes'. Currently ipa-replica-manage does not implement this flag.

Why do you use it in topology plugin.

there are two potential problems with the cleanallruv task:
1] the rid could come back if not all servers were in sync,  but with 
cleaning the changelog as part of cleanallruv I think the ris is low now
2] the cleanallruv is stuck on waiting for the task to complete on other 
servers even if they cannot be reached


I want to avoid 2] therefore I choose this setting
My concern is that if we delete a host before all the updates from 
that host has been received, could we receive a late update that will 
recreate the ruv element ?


thanks
thierry


-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Re: [Freeipa-devel] [PATCH 0019] handle cleanRUV in the topology plugin

2015-10-23 Thread thierry bordaz

On 10/23/2015 11:00 AM, thierry bordaz wrote:

On 10/12/2015 01:17 PM, Ludwig Krispenz wrote:


On 10/12/2015 12:44 PM, Martin Basti wrote:



On 23.07.2015 10:46, Ludwig Krispenz wrote:
The attached patch moves the cleaning of the RUV into the topology 
plugin.


I encountered a problem when removing a replica, which disconnects 
the topology, but it was fixed with my WIP for #5072.


I want to keep these issues separate, so please review and test the 
patch and let me know about issues found


Ludwig




Is this patch still valid and pending review?
it should be  still valid, waiting for review, wanted to rebase after 
topology/promotion patches have been checked in and resend





Hello Ludwig,

The patch looks good. I have few minor remarks:

  * Are the hostname in ruv always fqdn ? to retrieve the RUV element
of a given host you use 'strstr'.
If you have host vm-11 and vm-112, I wonder if it could pickup the
wrong RUV element
  * In ipa_topo_util_cleanruv_element you need a pblock_done/free (or
destroy)
  * In it fails to add the clearn-ruv task, you should log a message
so that the admin knows what to do.

thanks
thierry




Hi Ludwig,

Additional question. cleanruv is done with 'replica-force-cleaning: 
yes'. Currently ipa-replica-manage does not implement this flag.

Why do you use it in topology plugin.
My concern is that if we delete a host before all the updates from that 
host has been received, could we receive a late update that will 
recreate the ruv element ?


thanks
thierry
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Re: [Freeipa-devel] [PATCH 0019] handle cleanRUV in the topology plugin

2015-10-23 Thread thierry bordaz

On 10/12/2015 01:17 PM, Ludwig Krispenz wrote:


On 10/12/2015 12:44 PM, Martin Basti wrote:



On 23.07.2015 10:46, Ludwig Krispenz wrote:
The attached patch moves the cleaning of the RUV into the topology 
plugin.


I encountered a problem when removing a replica, which disconnects 
the topology, but it was fixed with my WIP for #5072.


I want to keep these issues separate, so please review and test the 
patch and let me know about issues found


Ludwig




Is this patch still valid and pending review?
it should be  still valid, waiting for review, wanted to rebase after 
topology/promotion patches have been checked in and resend





Hello Ludwig,

The patch looks good. I have few minor remarks:

 * Are the hostname in ruv always fqdn ? to retrieve the RUV element of
   a given host you use 'strstr'.
   If you have host vm-11 and vm-112, I wonder if it could pickup the
   wrong RUV element
 * In ipa_topo_util_cleanruv_element you need a pblock_done/free (or
   destroy)
 * In it fails to add the clearn-ruv task, you should log a message so
   that the admin knows what to do.

thanks
thierry

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Re: [Freeipa-devel] [PATCH 0019] handle cleanRUV in the topology plugin

2015-10-23 Thread Ludwig Krispenz

Here it is again

On 10/12/2015 01:17 PM, Ludwig Krispenz wrote:


On 10/12/2015 12:44 PM, Martin Basti wrote:



On 23.07.2015 10:46, Ludwig Krispenz wrote:
The attached patch moves the cleaning of the RUV into the topology 
plugin.


I encountered a problem when removing a replica, which disconnects 
the topology, but it was fixed with my WIP for #5072.


I want to keep these issues separate, so please review and test the 
patch and let me know about issues found


Ludwig




Is this patch still valid and pending review?
it should be  still valid, waiting for review, wanted to rebase after 
topology/promotion patches have been checked in and resend






>From 25548f31129c1d5887534a7c7591eb7b18f464cd Mon Sep 17 00:00:00 2001
From: Ludwig Krispenz 
Date: Thu, 22 Oct 2015 15:07:13 +0200
Subject: [PATCH] handle cleaning of RUV in the topology plugin

After removing a server the replicaid needs to be cleared in the ruv entry and
in the changelog.
This was triggere by initiating a cleanallruv task in "ipa-replica-manage del",
but the removal of a master already triggers a cleanup of segments and replication
agreement by the topology plugin, so this could be handled by the plugin as well.
---
 daemons/ipa-slapi-plugins/topology/topology.h  |  1 +
 daemons/ipa-slapi-plugins/topology/topology_post.c |  1 +
 daemons/ipa-slapi-plugins/topology/topology_util.c | 92 ++
 install/tools/ipa-replica-manage   |  7 +-
 4 files changed, 95 insertions(+), 6 deletions(-)

diff --git a/daemons/ipa-slapi-plugins/topology/topology.h b/daemons/ipa-slapi-plugins/topology/topology.h
index 1332c7bc76e4f4b091cbb691c8b61d8d9fee5d83..fea8281ac5f0865aca4052f6139e4384f5665b87 100644
--- a/daemons/ipa-slapi-plugins/topology/topology.h
+++ b/daemons/ipa-slapi-plugins/topology/topology.h
@@ -286,6 +286,7 @@ void ipa_topo_util_disable_repl_for_principal(char *repl_root, char *principal);
 void ipa_topo_util_add_host(Slapi_Entry *hostentry);
 void ipa_topo_util_delete_host(Slapi_Entry *hostentry);
 void ipa_topo_util_update_host(Slapi_Entry *hostentry, LDAPMod **mods);
+void ipa_topo_util_cleanruv(Slapi_Entry *hostentry);
 void ipa_topo_util_disable_repl_from_host(char *repl_root, char *delhost);
 void ipa_topo_util_delete_segments_for_host(char *repl_root, char *delhost);
 
diff --git a/daemons/ipa-slapi-plugins/topology/topology_post.c b/daemons/ipa-slapi-plugins/topology/topology_post.c
index c20de3cbe27c022a48da298d913ab795c883e954..5ac029a86a2f8ffbda895c5fe2a1af4c45152832 100644
--- a/daemons/ipa-slapi-plugins/topology/topology_post.c
+++ b/daemons/ipa-slapi-plugins/topology/topology_post.c
@@ -276,6 +276,7 @@ ipa_topo_post_del(Slapi_PBlock *pb)
  */
 ipa_topo_util_delete_host(del_entry);
 ipa_topo_cfg_host_del(del_entry);
+ipa_topo_util_cleanruv(del_entry);
 break;
 case TOPO_IGNORE_ENTRY:
 break;
diff --git a/daemons/ipa-slapi-plugins/topology/topology_util.c b/daemons/ipa-slapi-plugins/topology/topology_util.c
index 26f569c5186688c5336bee077efbf2fc1dddbfee..1e4a67558d5c9d47dcaae6d2633ca5dd9692ccf6 100644
--- a/daemons/ipa-slapi-plugins/topology/topology_util.c
+++ b/daemons/ipa-slapi-plugins/topology/topology_util.c
@@ -1779,3 +1779,95 @@ ipa_topo_util_is_tombstone_op(Slapi_PBlock *pb)
 slapi_pblock_get(pb, SLAPI_OPERATION, &op);
 return slapi_operation_is_flag_set(op, SLAPI_OP_FLAG_TOMBSTONE_ENTRY);
 }
+int
+ipa_topo_util_cleanruv_task(char *repl_root, int replicaID)
+{
+Slapi_Entry *e = NULL;
+Slapi_PBlock *pb;
+char *dn = NULL;
+char *repl_rid;
+Slapi_DN *sdn = NULL;
+int ret = 0;
+dn = slapi_ch_smprintf("cn=clean %d,cn=cleanallruv,cn=tasks,cn=config", replicaID);
+if (dn  == NULL) return -1;
+sdn = slapi_sdn_new_normdn_byref(dn);
+
+e = slapi_entry_alloc();
+/* the entry now owns the dup'd dn */
+slapi_entry_init_ext(e, sdn, NULL); /* sdn is copied into e */
+slapi_sdn_free(&sdn);
+
+slapi_entry_add_string(e, SLAPI_ATTR_OBJECTCLASS, "extensibleobject");
+slapi_entry_add_string(e, "replica-base-dn",repl_root);
+repl_rid = slapi_ch_smprintf("%d",replicaID);
+slapi_entry_add_string(e, "replica-id",repl_rid);
+slapi_entry_add_string(e, "replica-force-cleaning", "yes");
+
+pb = slapi_pblock_new();
+slapi_pblock_init(pb);
+
+/* e will be consumed by slapi_add_internal() */
+slapi_add_entry_internal_set_pb(pb, e, NULL, ipa_topo_get_plugin_id(), 0);
+slapi_add_internal_pb(pb);
+slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &ret);
+slapi_pblock_destroy(pb);
+slapi_ch_free_string(&repl_rid);
+
+return ret;
+
+}
+
+void
+ipa_topo_util_cleanruv_element(char *repl_root, char *hostname)
+{
+Slapi_PBlock *pb = NULL;
+char *filter = "(&(objectclass=nstombstone)(nsuniqueid=---))";
+char **ruv_ele = NULL;
+int ret;
+Slapi_Entry **entries = NULL;
+
+/* find ruv object */
+pb = slapi

Re: [Freeipa-devel] [PATCH 0019] handle cleanRUV in the topology plugin

2015-10-12 Thread Ludwig Krispenz


On 10/12/2015 12:44 PM, Martin Basti wrote:



On 23.07.2015 10:46, Ludwig Krispenz wrote:
The attached patch moves the cleaning of the RUV into the topology 
plugin.


I encountered a problem when removing a replica, which disconnects 
the topology, but it was fixed with my WIP for #5072.


I want to keep these issues separate, so please review and test the 
patch and let me know about issues found


Ludwig




Is this patch still valid and pending review?
it should be  still valid, waiting for review, wanted to rebase after 
topology/promotion patches have been checked in and resend


-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Re: [Freeipa-devel] [PATCH 0019] handle cleanRUV in the topology plugin

2015-10-12 Thread Martin Basti



On 23.07.2015 10:46, Ludwig Krispenz wrote:
The attached patch moves the cleaning of the RUV into the topology 
plugin.


I encountered a problem when removing a replica, which disconnects the 
topology, but it was fixed with my WIP for #5072.


I want to keep these issues separate, so please review and test the 
patch and let me know about issues found


Ludwig




Is this patch still valid and pending review?
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code