Bug 1227986

Summary: It will show two same hostnames on SAM/Satellite when monitoring the same machine
Product: Red Hat Satellite Reporter: Liushihui <shihliu>
Component: CandlepinAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Katello QA List <katello-qa-list>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.1.0CC: bbuckingham, bcourt, bkearney, ehelms, gxing, hsun, rbalakri, sgao, shihliu
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1246951 (view as bug list) Environment:
Last Closed: 2016-08-16 07:48:03 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: 1314902    
Bug Blocks: 1246951    
Attachments:
Description Flags
same host_diff register by
none
first host
none
second host none

Description Liushihui 2015-06-04 02:38:32 UTC
Description of problem:
Use two virt-who to monitor the same host, it will generate two kinds of hostnames. Firstly,when virt-who run at local libvirt mode, it will send the local hostname to SAM. However, if use another virt-who running at remote libvirt to monitor the previous host, it will send the hypervisor uuid to SAM. Therefore, you will see the same host with two different names on SAM/Satellite WebUI

Version-Release number of selected component (if applicable):
virt-who-0.12-8.el6.noarch
subscription-manager-1.14.6-1.el6.x86_64
python-rhsm-1.14.2-1.el6.x86_64
katello-headpin-1.4.3.28-1.el6sam_splice.noarch
candlepin-0.9.6.5-1.el6sam.noarch

How reproducible:
Always

Steps to Reproduce:
1.In the host1, configure virt-who run at libvirt mode,restart virt-who service
[root@hp-z220-05 rhsm]# cat /etc/sysconfig/virt-who
VIRTWHO_BACKGROUND=1
VIRTWHO_DEBUG=1
VIRTWHO_INTERVAL=3600
[root@hp-z220-05 rhsm]# tail -f /var/log/rhsm/rhsm.log
[root@hp-z220-05 rhsm]# service virt-who restart
2. check the host/guest association info in the /var/log/rhsm/rhsm.log
2015-06-04 10:10:41,478 [INFO]  @subscriptionmanager.py:116 - Sending domain info: [{'guestId': '137a41f8-a6e1-9ffe-a537-656d6dd1e8c5', 'attributes': {'active': 0, 'virtWhoType': 'libvirt', 'hypervisorType': 'QEMU'}, 'state': 5},]
2015-06-04 10:10:42,141 [INFO]  @virtwho.py:129 - virt-who guest list update successful
3. Register the guest to SAM/Satellite
4. Check the SAM/Satellite webUI, it will show guest's host is "host1name"
5. In the host2, configure virt-who run at remote libvirt mode to monitor host1, restart virt-who service
VIRTWHO_BACKGROUND=1
VIRTWHO_DEBUG=1
VIRTWHO_INTERVAL=3600
VIRTWHO_LIBVIRT=1
VIRTWHO_LIBVIRT_OWNER=ACME_Corporation
VIRTWHO_LIBVIRT_ENV=Library
VIRTWHO_LIBVIRT_SERVER=qemu+ssh://10.66.144.3/system
VIRTWHO_LIBVIRT_USERNAME=root
VIRTWHO_LIBVIRT_PASSWORD=
6. Check the host/guest association info in the /var/log/rhsm/rhsm.log
2015-06-04 10:20:26,379 [INFO]  @subscriptionmanager.py:123 - Sending update in hosts-to-guests mapping: {'003ac27c-ed28-e211-8973-10604b5b2b19': [{'guestId': '3394b8fa-a27b-43e0-fe39-82c587a80acd', 'attributes': {'active': 1, 'virtWhoType': 'libvirt', 'hypervisorType': 'QEMU'}, 'state': 1}, {'guestId': '69b59f9e-3e09-d8de-ac7e-c35c6e62f292', 'attributes': {'active': 0, 'virtWhoType': 'libvirt', 'hypervisorType': 'QEMU'}, 'state': 5}, {'guestId': '538cde5f-936e-9ca0-58ee-7528bbf86c2b', 'attributes': {'active': 0, 'virtWhoType': 'libvirt', 'hypervisorType': 'QEMU'}, 'state': 5}, {'guestId': '137a41f8-a6e1-9ffe-a537-656d6dd1e8c5', 'attributes': {'active': 0, 'virtWhoType': 'libvirt', 'hypervisorType': 'QEMU'}, 'state': 5}, {'guestId': '3c431b66-fbab-9cce-be3c-bc15ab2adf84', 'attributes': {'active': 0, 'virtWhoType': 'libvirt', 'hypervisorType': 'QEMU'}, 'state': 5}]}
7. In the SAM/Satellite webUI, Check the guest's host


Actual results:
After step6, it will generate a hypervisor uuid "003ac27c-ed28-e211-8973-10604b5b2b19"
After step7, In the SAM/Satellite WebUI, it will generate a new host "003ac27c-ed28-e211-8973-10604b5b2b19".Meanwhile, guest's host has been modified from "host1name" to "003ac27c-ed28-e211-8973-10604b5b2b19"

Expected results:
As virt-who is used to monitor the same machine, Whatever mode it is running, it should send the same hostname to SAM/Satellite. it shouldn't generate a new hypervisor uuid when virt-who run at remote libvirt mode.

Additional info:

Comment 2 Radek Novacek 2016-01-28 12:45:05 UTC
Can you please set up 'hypervisor_id=hostname' for the second part (remote libvirt)? It might help.

But generally I don't think we need to support the case when the same system is monitored by two different virt-who methods (libvirt local and libvirt remote) as those method can differ a lot.

Comment 3 Liushihui 2016-02-14 05:05:38 UTC
When set 'hypervisor_id=hostname' for remote libvirt, virt-who will generate a new host(the same hostname as before, different "Register by") to satellite. please see the screetshot in attachment.

Comment 4 Liushihui 2016-02-14 05:09:16 UTC
Created attachment 1126948 [details]
same host_diff register by

Comment 5 Radek Novacek 2016-02-16 15:50:36 UTC
This looks like bug in candlepin - it does not match the same host to itself.

OTOH I'm not sure we want to support this usecase. When user switches method how to get host/guest association (either between libvirt and remote libvirt, or vdsm and rhevm), I think it's ok to recreate the hosts.

If you think we should support this usecase, please switch this bug to candlepin for further evaluation.

Comment 6 Barnaby Court 2016-03-07 20:13:20 UTC
Can you please attach the virt-who reports that are generated for each system.

Comment 7 Liushihui 2016-03-09 06:26:24 UTC
Checked version:
virt-who-0.16-6.el6.noarch
python-rhsm-1.16.6-1.el6.x86_64
subscription-manager-1.16.8-4.el6.x86_64

Checked process:
1 Register host1 to satellite
2 On host1, run virt-who at local libvirt mode
[root@ibm-x3250m4-07 ~]# cat /etc/sysconfig/virt-who  | grep -v ^# | grep -v ^$
VIRTWHO_DEBUG=1
3 On host1, restart virt-who and check virt-who's log,it will send local host/guest mapping info to satellite
[root@ibm-x3250m4-07 ~]# service virt-who restart && tail -f /var/log/rhsm/rhsm.log 
Stopping virt-who: [  OK  ]
Starting virt-who: [  OK  ]
...........
2016-03-09 00:08:55,748 [virtwho.main INFO] MainProcess(26848):MainThread @subscriptionmanager.py:sendVirtGuests:147 - Sending update in guests lists for config "env/cmdline": 1 guests found
2016-03-09 00:08:55,748 [virtwho.main DEBUG] MainProcess(26848):MainThread @subscriptionmanager.py:sendVirtGuests:148 - Domain info: [
    {
        "guestId": "d06af74a-2372-6554-d465-a8474fda6e00", 
        "state": 5, 
        "attributes": {
            "active": 0, 
            "hypervisorVersion": "0.12.1", 
            "virtWhoType": "libvirt", 
            "hypervisorType": "QEMU"
        }
    }
]
2016-03-09 00:08:58,104 [virtwho.main DEBUG] MainProcess(26848):MainThread @virtwho.py:send_report:161 - Report for config "env/cmdline" sent
4. Go to satellite webUI, it will show host1's hostname in content-host page. registered by "Admin User" , please see the screenshot "first host.jpeg"

5. In host2: configure virt-who run at remote libvirt to monitor host1.
[root@ibm-x3250m4-08 ~]# cat /etc/virt-who.d/virt 
[t-libvirt]
type=libvirt
server=qemu+ssh://ibm-x3250m4-07.rhts.eng.bos.redhat.com/system
username=root
password=qwer1234P!
owner=ACME_Corporation
env=Library 
hypervisor_id=hostname
6 On host2, restart virt-who and check virt-who's log,it will send host1's host/guest mapping info to satellite
2016-03-09 01:15:38,036 [virtwho.main DEBUG] MainProcess(25609):MainThread @subscriptionmanager.py:hypervisorCheckIn:186 - Host-to-guest mapping: {
    "ibm-x3250m4-07.rhts.eng.bos.redhat.com": [
        {
            "guestId": "d06af74a-2372-6554-d465-a8474fda6e00", 
            "state": 5, 
            "attributes": {
                "active": 0, 
                "hypervisorVersion": "0.12.1", 
                "virtWhoType": "libvirt", 
                "hypervisorType": "QEMU"
            }
        }
    ]
}
7. Go to satellite webUI, it will show a new host1's hostname in content-host page. but registered by "683a8bb9-0f1a-464d-88a1-7dd309ab9af0", please see the screenshot "second host.jpeg"

Result:
Although virt-who report the same host's mapping info to satellite, it will show two same hostname in content host page.

Expected result:
Since virt-who report the same host's mapping info to satellite, it should show the same hostname in content host page.

Comment 8 Liushihui 2016-03-09 06:29:55 UTC
Created attachment 1134393 [details]
first host

Comment 9 Liushihui 2016-03-09 06:30:51 UTC
Created attachment 1134394 [details]
second host

Comment 10 Barnaby Court 2016-06-01 19:07:25 UTC
Fixed upstream in virt-who-0.17-1

Comment 12 Bryan Kearney 2016-08-04 14:40:59 UTC
MODIFIED

Comment 16 errata-xmlrpc 2016-08-16 07:48:03 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:1616