Hide Forgot
Created attachment 1214661 [details] error message screenshot Description of problem: When I try to add cloud provider/rename existing one with the name that was used earlier, I get an error "Name has already been taken"/"Network_manager.name". So, the name cannot be re-used. Version-Release number of selected component (if applicable): CFME 5.6.2.2 How reproducible: 100 % but sometimes the steps need to be repeat once more Steps to Reproduce: 1. Add cloud provider (f.e. Azure/EC2) with some name to CFME 2. Remove the provider 3. Logout from appliance 4. Login to appliance 5. Try to add such provider with same name again (reproduced with renaming) Actual results: The error "Name has already been taken"/"Network_manager.name" appears. So, the name cannot be re-used. Expected results: There shouldn't be such a restriction Additional info:
Created attachment 1214663 [details] one more error
Actually, I noticed destroy messages and providers were removed from the db but Network Managers remained. Apparently, that's a reason why next attempts failed. select id, name from ext_management_systems; "id","name" "5","azure Network Manager" "8","ec2-west Network Manager" select id, class_name, method_name, queue_name from miq_queue; "id","class_name","method_name","queue_name" "25","MiqServer","shutdown_and_exit","miq_server" "591","EmsRefresh","refresh","ems_8" "475","EmsRefresh","refresh","ems_5" "197","MiqServer","shutdown_and_exit","miq_server" I'd also say that I noticed a moment when EC2 Network Manager disappeared from the table and appeared later again. It seems destroy operation isn't done in one transaction.
I'm leaving this appliance up for a while - 10.16.5.142. So, you can use it for reproducing the issue if you want.
Looks like the same thing has been hit by https://bugzilla.redhat.com/show_bug.cgi?id=1393675 and https://bugzilla.redhat.com/show_bug.cgi?id=1394432 So maybe not so much of an edge case?
https://github.com/ManageIQ/manageiq/pull/12878
For record purpose, this is how I managed to reproduce this problem manually, 1. In rails console, EmsRefresh.refresh(ems-cloud-instance) and put a debug to hold it right before inventory saving 2. In another rails console, run ems-cloud-instance.destroy. You can confirm that both manager ems are gone from db 3. Back to first console and let it continue to run. It will failed with something like not able to find the cloud ems instance, but a new record of network manager is created in db.
New commit detected on ManageIQ/manageiq-providers-amazon/master: https://github.com/ManageIQ/manageiq-providers-amazon/commit/13cbb68b282c26449752c6127cba9e9c111a592b commit 13cbb68b282c26449752c6127cba9e9c111a592b Author: Marcel Hild <hild> AuthorDate: Mon Nov 28 15:13:11 2016 +0100 Commit: Marcel Hild <hild> CommitDate: Mon Nov 28 15:13:11 2016 +0100 Add managers in before_create callback instead of before_validation otherwise it could happen that one process deletes the manager and another one saves it and the saving one would add back a deleted manager. https://bugzilla.redhat.com/show_bug.cgi?id=1389459 https://bugzilla.redhat.com/show_bug.cgi?id=1393675 app/models/manageiq/providers/amazon/cloud_manager.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
New commit detected on ManageIQ/manageiq/master: https://github.com/ManageIQ/manageiq/commit/fab74b285e2d93f85456d9a0985081b5eb7b9aff commit fab74b285e2d93f85456d9a0985081b5eb7b9aff Author: Marcel Hild <hild> AuthorDate: Mon Nov 28 15:02:56 2016 +0100 Commit: Marcel Hild <hild> CommitDate: Mon Nov 28 15:02:56 2016 +0100 Add managers in before_create callback instead of before_validation otherwise it could happen that one process deletes the manager and another one saves it and the saving one would add back a deleted manager. https://bugzilla.redhat.com/show_bug.cgi?id=1389459 https://bugzilla.redhat.com/show_bug.cgi?id=1393675 app/models/manageiq/providers/foreman/provider.rb | 2 +- app/models/manageiq/providers/google/cloud_manager.rb | 2 +- app/models/manageiq/providers/openstack/cloud_manager.rb | 2 +- app/models/manageiq/providers/openstack/infra_manager.rb | 2 +- app/models/manageiq/providers/vmware/cloud_manager.rb | 2 +- spec/controllers/provider_foreman_controller_spec.rb | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-)
New commit detected on ManageIQ/manageiq-providers-azure/master: https://github.com/ManageIQ/manageiq-providers-azure/commit/a2acb585c09633f903c194aae227fdf50e591a13 commit a2acb585c09633f903c194aae227fdf50e591a13 Author: Marcel Hild <hild> AuthorDate: Mon Nov 28 15:10:55 2016 +0100 Commit: Marcel Hild <hild> CommitDate: Mon Nov 28 15:10:55 2016 +0100 Add managers in before_create callback instead of before_validation otherwise it could happen that one process deletes the manager and another one saves it and the saving one would add back a deleted manager. https://bugzilla.redhat.com/show_bug.cgi?id=1389459 https://bugzilla.redhat.com/show_bug.cgi?id=1393675 app/models/manageiq/providers/azure/cloud_manager.rb | 2 +- .../manageiq/providers/azure/cloud_manager_spec.rb | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-)
https://github.com/ManageIQ/manageiq/pull/12381
https://github.com/ManageIQ/manageiq/pull/12381 has nothing to do with this BZ - not sure how it ended up here. its https://github.com/ManageIQ/manageiq/pull/12878 that fixes this
Verified on 5.8.0.14-rc3.