Bug 1340088

Summary: Duplicate entries for hypervisors after renaming content host
Product: Red Hat Satellite Reporter: Stefan Meyer <smeyer>
Component: HostsAssignee: Tom McKay <tomckay>
Status: CLOSED ERRATA QA Contact: Katello QA List <katello-qa-list>
Severity: high Docs Contact:
Priority: high    
Version: 6.2.0CC: akarimi, cwelton, mmccune, sghai, tomckay
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: rubygem-katello-3.0.0.53-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 11:26:51 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:
Attachments:
Description Flags
before renaming the content-host
none
after renaming and rerunning virt-who can see only on entry with name rhevh none

Description Stefan Meyer 2016-05-26 12:35:08 UTC
Description of problem:
After renaming the hypervisor in /content_hosts and another run of virt-who
the hypervisor content host is again created with a random name but with
the same uuid.

Version-Release number of selected component (if applicable):
Satellite 6.2 SNAP 13.1
virt-who 0.14-9.el7

How reproducible:
With every virt-who run

Steps to Reproduce:
1. Register hypervisor via virt-who
2. Rename hypervisor in /content_hosts
3. Run virt-who again

Actual results:
A new entry is created in /content_hosts

Expected results:
Only update the already existing content host

Additional info:
- virt-who is always sending the correct hypervisor uuid
- looks like the unique identifier was changed from the content hosts uuid to the name
- this is a regression as it worked fine in 6.1

Comment 1 Tom McKay 2016-05-26 12:51:11 UTC
Created redmine issue http://projects.theforeman.org/issues/15197 from this bug

Comment 2 Tom McKay 2016-05-26 12:56:52 UTC
Note that the host name is not changed in candlepin, which I think is a good thing. In katello, when looking for existing hypervisors to match on the results returned from candlepin, the UUID needs to be searched for with the fallback being the name.

This situation will lead to corrupt database since there will be multiple hosts referencing a single candlepin consumer. If the consumer is deleted (ie. one of the hosts is deleted) then the other records will fail w/ errors when queried.

Comment 3 Bryan Kearney 2016-05-26 14:17:28 UTC
Upstream bug assigned to tomckay

Comment 4 Bryan Kearney 2016-05-26 14:17:31 UTC
Upstream bug component is Hosts

Comment 5 Bryan Kearney 2016-05-26 14:17:34 UTC
Upstream bug assigned to tomckay

Comment 8 Bryan Kearney 2016-06-02 22:16:50 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/15197 has been closed

Comment 9 Sachin Ghai 2016-07-01 10:57:11 UTC
Verified with sat62 GA snap18.1

I registered rhev hypervisor with satellite62 server and later changed the content-host name from "virt-who-rhevh2-1" to "rhevh2". Content host was successfully renamed after running virt-who without another duplicate entry.

Comment 10 Sachin Ghai 2016-07-01 10:59:57 UTC
Created attachment 1174877 [details]
before renaming the content-host

Comment 11 Sachin Ghai 2016-07-01 11:01:39 UTC
Created attachment 1174879 [details]
after renaming and rerunning virt-who can see only on entry with name rhevh

Comment 12 Bryan Kearney 2016-07-27 11:26:51 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2016:1501