Bug 1035957

Summary: virt-who can't send mapping info to subscription-manager after virt-who run at VIRTWHO_INTERVAL=3600
Product: Red Hat Enterprise Linux 7 Reporter: Liushihui <shihliu>
Component: virt-whoAssignee: Radek Novacek <rnovacek>
Status: CLOSED CURRENTRELEASE QA Contact: gaoshang <sgao>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.0CC: liliu, ovasik, qianzhan, sgao
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: virt-who-0.8-10.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 12:47:40 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:
Attachments:
Description Flags
virt-who's log when run at interval =3600 none

Description Liushihui 2013-11-29 02:52:46 UTC
Description of problem:
When virt-who run as refresh interval to 3600s, after 3600s ,it will send the null host/guest mapping message to subscription-manager

Version-Release number of selected component (if applicable):
virt-who-0.8-8.el7.noarch
python-rhsm-1.10.6-1.el7.x86_64
subscription-manager-1.10.6-1.el7.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Prepare RHEL7.0 with latest subscription-manager and virt-who installed. 
Two ESX5.5 hosts have been added to vcenter5.5, And ESX host1 with three guests.ESX host2 without guest, Guest1 on ESX host1
Our test env as the following:
vCenter: 10.66.79.63
ESX host 1: 10.66.13.181
ESX host 2: 10.66.13.187

2. Configure virt-who in ESX mode as the following, Then start virt-who, Make sure virt-who run normally:
[root@hp-z220-03 ~]# cat /etc/sysconfig/virt-who 
    VIRTWHO_BACKGROUND=1
    # Enable debugging output.
    VIRTWHO_DEBUG=1
    VIRTWHO_INTERVAL=3600 
    # Register ESX machines using vCenter
    VIRTWHO_ESX=1
    # Option for ESX mode
    VIRTWHO_ESX_OWNER=ACME_Corporation
    VIRTWHO_ESX_ENV=Library
    VIRTWHO_ESX_SERVER=10.66.79.63
    VIRTWHO_ESX_USERNAME=Administrator
    VIRTWHO_ESX_PASSWORD=qwer1234P!
[root@dhcp-65-83 /]# systemctl start virt-who

3. Register the RHEL7.0 to SAM server(Make sure two ESX hosts have been register to SAM server)
# Subscription-manager register --username=admin --password=admin
  Register Guest1 to SAM server(guest1 is on host1)
# Subscription-manager register --username=admin --password=admin

4. Check the log in the /var/log/rhsm/rhsm.log, virt-who has been started.
2013-11-28 16:37:45,875 [WARNING]  @virt-who.py:462 - Listening for events is not available in VDSM, ESX, RHEV-M or Hyper-V mode
2013-11-28 16:37:52,479 [DEBUG]  @virt-who.py:475 - Virt-who is running in esx mode
2013-11-28 16:37:52,480 [DEBUG]  @virt-who.py:482 - Starting infinite loop with 3600 seconds interval and event handling
2013-11-28 16:37:53,283 [DEBUG]  @subscriptionmanager.py:89 - Sending update in hosts-to-guests mapping: {44454c4c-4c00-1031-8053-b8c04f4e3258: [], 44454c4c-4200-1034-8039-b8c04f503258: [564db05b-769f-69ac-642a-8b7916f7be7a, 42268a03-b68f-52e6-805f-9126c3b006dd, 4226082e-2746-17dc-6f01-dc91c6fc7fbb, 4226a1bf-d361-fd50-9d0c-50b5b56c982a, 42264b6e-e140-4354-a8e8-9efff7b99e06]}

3. During the intervel(3600s), Do as the following steps:
step1: In the SAM web UI, host1 subscribe the datacenter subscription
step2: In the guest1, subscribe the datacenter subpool which generate by host1, then list the consumed subcription
[root@dhcp-13-87 ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name: Red Hat Enterprise Linux Server for HPC Compute Node, Self-support (8 sockets) (Up to 1 guest)
Provides:          Red Hat Enterprise Linux for Scientific Computing
                   Red Hat Beta
SKU:               RH0604852
Contract:          
Account:           
Serial:            7345738430410344447
Pool ID:           8ac28c34420cac1601429e07739e33c1
Active:            True
Quantity Used:     1
Service Level:     SELF-SUPPORT
Service Type:      L1-L3
Status Details:    
Starts:            12/31/2012
Ends:              12/31/2013
System Type:       Virtual
step3: Migrate guest1 from host1 to host2

4. Wait for one hours later, check the rhsm.log in the /var/log/rhsm/rhsm.log
5. In the SAM web UI, check the guest1's host
6. In the guest1, Check the consumed subscription

Actual results:
After step4: virt-who send null host/guest mapping info to subscription-manager
2013-11-28 17:37:56,481 [DEBUG]  @subscriptionmanager.py:89 - Sending update in hosts-to-guests mapping: {}
2013-11-28 18:37:59,399 [DEBUG]  @subscriptionmanager.py:89 - Sending update in hosts-to-guests mapping: {}
After step5: guest1's host still is host1
After step6: it still display the old consumed subscription
[root@dhcp-13-87 ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name: Red Hat Enterprise Linux Server for HPC Compute Node, Self-support (8 sockets) (Up to 1 guest)
Provides:          Red Hat Enterprise Linux for Scientific Computing
                   Red Hat Beta
SKU:               RH0604852
Contract:          
Account:           
Serial:            7345738430410344447
Pool ID:           8ac28c34420cac1601429e07739e33c1
Active:            True
Quantity Used:     1
Service Level:     SELF-SUPPORT
Service Type:      L1-L3
Status Details:    
Starts:            12/31/2012
Ends:              12/31/2013
System Type:       Virtual

Expected results:
After step4: It should send the correct host/guest mapping to subscription-manager, just as the following:
2013-11-28 15:37:53,283 [DEBUG]  @subscriptionmanager.py:89 - Sending update in hosts-to-guests mapping: {44454c4c-4c00-1031-8053-b8c04f4e3258: [564db05b-769f-69ac-642a-8b7916f7be7a], 44454c4c-4200-1034-8039-b8c04f503258: [ 42268a03-b68f-52e6-805f-9126c3b006dd, 4226082e-2746-17dc-6f01-dc91c6fc7fbb, 4226a1bf-d361-fd50-9d0c-50b5b56c982a, 42264b6e-e140-4354-a8e8-9efff7b99e06]}
After step5: In the SAM web UI, guest1's host should be host2
After step6: In the guest1, The consumed subpool should be revoke after migrate from host1 to host2

Additional info:
If set the intervel to 5s-600s, it hasn't this problem.please see the rhsm.log in the attachment

Comment 1 Liushihui 2013-11-29 02:53:53 UTC
Created attachment 830434 [details]
virt-who's log when run at interval =3600

Comment 4 Radek Novacek 2013-12-10 11:50:13 UTC
This is caused by expiration of user credential with too long interval between requests. It can be solved by forcing virt-who to relogin to ESX before each request.

Comment 5 Radek Novacek 2013-12-12 08:37:04 UTC
Fixed in virt-who-0.8-10.el7.

Comment 7 Liushihui 2013-12-23 04:17:02 UTC
According to the bug description, it can't be reproduce. 
Verify it on Rhel7.0-20131219.0(virt-who-0.8-10.el7)

Comment 8 Ludek Smid 2014-06-13 12:47:40 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.