Bug 1422901

Summary: Unable to use the same tenant name across multiple regions.
Product: Red Hat CloudForms Management Engine Reporter: Josh Carter <jocarter>
Component: ApplianceAssignee: Gregg Tanzillo <gtanzill>
Status: CLOSED CURRENTRELEASE QA Contact: Pavol Kotvan <pakotvan>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 5.7.0CC: abellott, byount, clasohm, gtanzill, jhardy, jrafanie, myoder, obarenbo, saali
Target Milestone: GAKeywords: TestOnly
Target Release: 5.10.0   
Hardware: All   
OS: All   
Whiteboard: distributed:cfme_tenant
Fixed In Version: 5.10.0.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1517954 (view as bug list) Environment:
Last Closed: 2018-06-21 20:55:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1517954    

Description Josh Carter 2017-02-16 14:10:03 UTC
Description of problem:

Problem Description
#######################
- CFME 4.2
- Trying to rename the tenant in our global CloudForms region from "My Company" to "Kaiser Permanente"
- When trying to use "Kaiser Permanente" in Tenant name, CFME is returning this error msg:
 "Error when adding a new tenant: Validation failed: Name should be unique per parent"
- But when trying to use "Kaiser Permanente Global", it works. 
- Assuming that the uniqueness check for the name doesn't filter by region, and sees that the tenant name returning error in the global region is already used by a local region.

Action Taken
#######################
Collected tenant info from SQL query(select * from tenants;)
=> Confirmed that there are 3 local regional tenants with "Kaiser Permanente" and 1 global tenant with "Kaiser Permanente Global" which originated from "My Company"
Checked collected logs from 3 UI nodes, found related err and change.

<UI node 14>
E, [2017-02-15T14:49:58.325164 #2478:16ece80] ERROR -- : MIQ(ops_controller-rbac_tenant_edit): Error when adding a new tenant: Validation failed: Name should be unique per parent

<UI node 15>
E, [2017-02-15T14:54:53.275167 #25438:ccc478] ERROR -- : MIQ(ops_controller-rbac_tenant_edit): Error when adding a new tenant: Validation failed: Name should be unique per parent

I, [2017-02-15T15:04:42.603757 #30991:d3e76c]  INFO -- Success: MIQ(OpsRbac.rbac_tenant_edit) userid: [admin] - [Kaiser Permanente Global] Record updated (name changed to Kaiser Permanente Global, description changed to Kaiser Permanente Global, region_number changed to , region_description changed to , allocated_memory changed to , allocated_vcpu changed to , allocated_storage changed to , provisioned_storage changed to , parent_name changed to , display_type changed to )

Request to Collaborator

Version-Release number of selected component (if applicable): 5.7.0.


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 4 Gregg Tanzillo 2017-11-20 21:02:00 UTC
Yoder, I just created a PR for this - https://github.com/ManageIQ/manageiq/pull/16506

Comment 5 CFME Bot 2017-11-27 16:12:05 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/f2d4533a79ce05c3ef751ec66c710a4b231910ee

commit f2d4533a79ce05c3ef751ec66c710a4b231910ee
Author:     Gregg Tanzillo <gtanzill>
AuthorDate: Mon Nov 20 15:58:25 2017 -0500
Commit:     Gregg Tanzillo <gtanzill>
CommitDate: Mon Nov 20 16:03:51 2017 -0500

    Scope Tenant#name validation to the current region
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1422901

 app/models/tenant.rb       | 4 +++-
 spec/models/tenant_spec.rb | 9 +++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)