Bug 1410317

Summary: [Satellite5.7] Restart virt-who will generate two same hypervisors on webUI after delete profiles in /var/lib/virt-who
Product: Red Hat Enterprise Linux 6 Reporter: Liushihui <shihliu>
Component: virt-whoAssignee: Chris Snyder <csnyder>
Status: CLOSED NOTABUG QA Contact: Eko <hsun>
Severity: medium Docs Contact:
Priority: high    
Version: 6.8CC: hsun, pcreech, rbalakri, sgao, tlestach, vrjain
Target Milestone: rcKeywords: Triaged
Target Release: 6.9   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-03-31 15:22:17 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
hypervisors.jpeg none

Description Liushihui 2017-01-05 06:17:14 UTC
Description of problem:
After delete profiles in /var/lib/virt-who/, restart virt-who will generate two same hypervisors in satelite webUI.

Version-Release number of selected component (if applicable):
virt-who-0.18-1.el6.noarch
subscription-manager-1.18.6-1.el6.x86_64
python-rhsm-1.18.6-1.el6.x86_64
Satellite5.7

How reproducible:
Always

Steps to Reproduce:
1. Configure virt-who run at esx mode and send host/guest association to satellite5.7, virt-who send two esx hypervisor to satellite5.7
[root@hp-z220-05 virt-who]#  virt-who --satellite --satellite-server=satellite57jan3.redhat.com --satellite-username=admin --satellite-password=redhat --esx --esx-server=10.73.3.161 --esx-username=Administrator --esx-password=Welcome1! -o -d

2. Go to satellite5.7 webUI, it will show two different hypervisors under "system" tab
"58a14d56-558b-61d0-fbdf-b690cf7255df"
"9fea4d56-5ed5-ddfe-b806-e7872726c0d7"

3. Check the profiles under the /var/lib/virt-who
[root@hp-z220-05 virt-who]# ll /var/lib/virt-who/
total 8
-rw-rw-rw-. 1 root root 1678 Jan  4 22:40 hypervisor-systemid-58a14d56-558b-61d0-fbdf-b690cf7255df
-rw-rw-rw-. 1 root root 1678 Jan  4 22:40 hypervisor-systemid-9fea4d56-5ed5-ddfe-b806-e7872726c0d7

4. Delete the profiles under the /var/lib/virt-who
[root@hp-z220-05 virt-who]# rm -rf /var/lib/virt-who/*

5. Rerun virt-who again as step1. check virt-who's log, it has send host/guest mapping info to satellite5.7 successfully.
[root@hp-z220-05 virt-who]#  virt-who --satellite --satellite-server=satellite57jan3.redhat.com --satellite-username=admin --satellite-password=redhat --esx --esx-server=10.73.3.161 --esx-username=Administrator --esx-password=Welcome1! -o -d

6. Go to satellite5.7 webUI, Check hypervisors under the "system" tab. 


Actual results:
It will show two same hypervisor items in the webUI. please see screenshot in attachment hypervisors.jpeg

Expected results:
It should show same hypervisor once in satellite webUI.

Additional info:

Comment 1 Liushihui 2017-01-05 06:19:02 UTC
Created attachment 1237498 [details]
hypervisors.jpeg

Comment 2 Tomas Lestach 2017-01-05 17:47:54 UTC
So far I know virt-who creates the profiles in Sat5. Sat5 cannot influence, what API calls are called by virt-who. If virt-who creates two profiles, there are two profiles in Sat5. Expected behavior from Sat5 POV.

I'm re-assigning to virt-who.

Comment 7 Patrick Creech 2017-03-31 15:22:17 UTC
The data stored in /var/lib/virtwho/hypervisor-systemid-* files are the system certificates returned from satellite registration.  Deleting these files is akin to unregistering the machine from satellite, and therefore their original profiles should be deleted in satellite.

After deletion of this file, there is simply no way to re-associate the system with the existing profile in satellite, so we must make a new one.  Please don't delete the files under /var/lib/virtwho without having backups.