Bug 1346577

Summary: virt-who can't fetch the correct mapping info if use xencenter to manage the xen hosts
Product: Red Hat Enterprise Linux 7 Reporter: Eko <hsun>
Component: virt-whoAssignee: Radek Novacek <rnovacek>
Status: CLOSED ERRATA QA Contact: Eko <hsun>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: ovasik, sgao, shihliu
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: virt-who-0.17-3.el7 Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-04 05:09: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:

Description Eko 2016-06-15 03:38:55 UTC
Description of problem:
There are two xen hosts in the xencenter pool (xen-01, xen-02), 
configure virt-who for them:
 xen-01 for /etc/sysconfig/virt-who
 xen-02 for /etc/virt-who.d/xen.conf
and then restart virt-who, only can fetch xen-01 host/guests mapping info.  

Version-Release number of selected component (if applicable):
virt-who-0.17-2.el7.noarch

How reproducible:
always

Steps to Reproduce:
1. prepare two xen hosts (xen-01, xen-02)

2. prepare a xencenter and create a pool, add the two xen hosts to the pool, make xen-01 as the master host
 
3. configure virt-who as following:
=== config xen-01 host in /etc/virt-who.d/xen.conf  ===
[test-xen]
type=xen
server=10.73.5.232
username=root
password=Welcome1
owner=ACME_Corporation
env=Library

=== config xen-02 host in /etc/sysconfig/virt-who  ===
VIRTWHO_XEN=1
VIRTWHO_XEN_OWNER=ACME_Corporation
VIRTWHO_XEN_ENV=Library
VIRTWHO_XEN_SERVER=10.73.5.238
VIRTWHO_XEN_USERNAME=root
VIRTWHO_XEN_PASSWORD=Welcome1

4. restart virt-who service and check the rhsm.log
=== two same json info will be found === 
2016-06-14 23:05:02,045 [virtwho.init DEBUG] MainProcess(28620):MainThread @executor.py:__init__:65 - Using config named 'test-xen'
2016-06-14 23:05:02,045 [virtwho.init INFO] MainProcess(28620):MainThread @main.py:main:157 - Using configuration "test-xen" ("xen" mode)
2016-06-14 23:05:02,045 [virtwho.init INFO] MainProcess(28620):MainThread @main.py:main:157 - Using configuration "env/cmdline" ("xen" mode)
2016-06-14 23:05:02,045 [virtwho.init INFO] MainProcess(28620):MainThread @main.py:main:159 - Using reporter_id='hp-z220-12.qe.lab.eng.nay.redhat.com-1f643a596c4148b982bf6d1daea912e2'
2016-06-14 23:05:02,047 [virtwho.main DEBUG] MainProcess(28620):MainThread @executor.py:run:171 - Starting infinite loop with 120 seconds interval
2016-06-14 23:05:02,076 [virtwho.test-xen DEBUG] Xen-1(28627):MainThread @virt.py:run:364 - Virt backend 'test-xen' started
2016-06-14 23:05:02,077 [virtwho.env_cmdline DEBUG] Xen-2(28629):MainThread @virt.py:run:364 - Virt backend 'env/cmdline' started
2016-06-14 23:05:02,076 [virtwho.test-xen DEBUG] Xen-1(28627):MainThread @xen.py:_prepare:42 - Logging into XEN pools https://10.73.5.232
2016-06-14 23:05:02,078 [virtwho.env_cmdline DEBUG] Xen-2(28629):MainThread @xen.py:_prepare:42 - Logging into XEN pools https://10.73.5.238
2016-06-14 23:05:02,106 [virtwho.env_cmdline DEBUG] Xen-2(28629):MainThread @xen.py:login:57 - Switching to new master: https://10.73.5.232
2016-06-14 23:05:02,190 [virtwho.test-xen DEBUG] Xen-1(28627):MainThread @xen.py:login:52 - XEN pool login successful with user root
2016-06-14 23:05:02,276 [virtwho.env_cmdline DEBUG] Xen-2(28629):MainThread @xen.py:login:52 - XEN pool login successful with user root
2016-06-14 23:05:02,720 [virtwho.test-xen DEBUG] Xen-1(28627):MainThread @xen.py:getHostGuestMapping:78 - Control Domain 08e0ada5-04f6-49ab-b703-0eed24587ba8 is ignored
2016-06-14 23:05:02,787 [virtwho.test-xen DEBUG] Xen-1(28627):MainThread @xen.py:getHostGuestMapping:78 - Control Domain 4d0c2b83-db73-454b-885f-7acfe4530a3c is ignored
2016-06-14 23:05:02,787 [virtwho.test-xen DEBUG] Xen-1(28627):MainThread @virt.py:enqueue:357 - Report for config "test-xen" gathered, putting to queue for sending
2016-06-14 23:05:02,798 [virtwho.main DEBUG] MainProcess(28620):MainThread @subscriptionmanager.py:_connect:123 - Authenticating with certificate: /etc/pki/consumer/cert.pem
2016-06-14 23:05:02,851 [virtwho.env_cmdline DEBUG] Xen-2(28629):MainThread @xen.py:getHostGuestMapping:78 - Control Domain 08e0ada5-04f6-49ab-b703-0eed24587ba8 is ignored
2016-06-14 23:05:02,916 [virtwho.env_cmdline DEBUG] Xen-2(28629):MainThread @xen.py:getHostGuestMapping:78 - Control Domain 4d0c2b83-db73-454b-885f-7acfe4530a3c is ignored
2016-06-14 23:05:02,916 [virtwho.env_cmdline DEBUG] Xen-2(28629):MainThread @virt.py:enqueue:357 - Report for config "env/cmdline" gathered, putting to queue for sending
2016-06-14 23:05:02,967 [virtwho.main DEBUG] MainProcess(28620):MainThread @subscriptionmanager.py:hypervisorCheckIn:171 - Checking if server has capability 'hypervisor_async'
2016-06-14 23:05:03,143 [virtwho.main DEBUG] MainProcess(28620):MainThread @subscriptionmanager.py:hypervisorCheckIn:183 - Server does not have 'hypervisors_async' capability
2016-06-14 23:05:03,143 [virtwho.main INFO] MainProcess(28620):MainThread @subscriptionmanager.py:hypervisorCheckIn:194 - Sending update in hosts-to-guests mapping for config "test-xen": 1 hypervisors and 1 guests found
2016-06-14 23:05:03,143 [virtwho.main DEBUG] MainProcess(28620):MainThread @subscriptionmanager.py:hypervisorCheckIn:195 - Host-to-guest mapping: {
    "3ab09fa8-e3cb-4e1c-874c-97105b556dc8": [
        {
            "guestId": "4994703d-7667-dafc-9433-c29136187d17", 
            "state": 1, 
            "attributes": {
                "active": 1, 
                "virtWhoType": "xen"
            }
        }
    ]
}
2016-06-14 23:05:03,828 [virtwho.main DEBUG] MainProcess(28620):MainThread @executor.py:send_report:101 - Report for config "test-xen" sent
2016-06-14 23:05:03,831 [virtwho.main DEBUG] MainProcess(28620):MainThread @subscriptionmanager.py:_connect:123 - Authenticating with certificate: /etc/pki/consumer/cert.pem
2016-06-14 23:05:04,006 [virtwho.main DEBUG] MainProcess(28620):MainThread @subscriptionmanager.py:hypervisorCheckIn:171 - Checking if server has capability 'hypervisor_async'
2016-06-14 23:05:04,176 [virtwho.main DEBUG] MainProcess(28620):MainThread @subscriptionmanager.py:hypervisorCheckIn:183 - Server does not have 'hypervisors_async' capability
2016-06-14 23:05:04,176 [virtwho.main INFO] MainProcess(28620):MainThread @subscriptionmanager.py:hypervisorCheckIn:194 - Sending update in hosts-to-guests mapping for config "env/cmdline": 1 hypervisors and 1 guests found
2016-06-14 23:05:04,176 [virtwho.main DEBUG] MainProcess(28620):MainThread @subscriptionmanager.py:hypervisorCheckIn:195 - Host-to-guest mapping: {
    "3ab09fa8-e3cb-4e1c-874c-97105b556dc8": [
        {
            "guestId": "4994703d-7667-dafc-9433-c29136187d17", 
            "state": 1, 
            "attributes": {
                "active": 1, 
                "virtWhoType": "xen"
            }
        }
    ]
}
2016-06-14 23:05:04,835 [virtwho.main DEBUG] MainProcess(28620):MainThread @executor.py:send_report:101 - Report for config "env/cmdline" sent



Actual results:
virt-who can't fetch the correct mapping info if use xencenter to manage the xen host.

Expected results:
virt-who should fetch the right mapping info according to the different configure options.

Additional info:

Comment 3 Radek Novacek 2016-06-23 14:42:26 UTC
Fixed in virt-who-0.17-3.el7.

Comment 5 Eko 2016-06-30 08:06:04 UTC
verified with virt-who-0.17-3.el7, the result is:

=== if no xencenter pool ===
1). config virt-who with xenserver-01, will get the host/guests info from xenserver01
2). config virt-who with xenserver-02, will get the host/guests info from xenserver02

=== if xencenter pool ===
1). config virt-who with xenserver-01, will get the host/guests info according to xencenter pool
2). config virt-who with xenserver-02, will get the host/guests info according to xencenter pool

Comment 7 errata-xmlrpc 2016-11-04 05:09: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://rhn.redhat.com/errata/RHBA-2016-2387.html