Bug 1318503

Summary: Failed to communicate with subscription-manager as "undefined local variable or method `hypervisor' "
Product: [Community] Candlepin Reporter: Liushihui <shihliu>
Component: candlepinAssignee: candlepin-bugs
Status: CLOSED WONTFIX QA Contact: Katello QA List <katello-qa-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 0.9CC: ldai, mstead, rbalakri, sgao, shihliu
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 19:02:19 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
virtwho_candlepin_log none

Description Liushihui 2016-03-17 05:53:15 UTC
Description of problem:
Sometimes virt-who failed to send host/guest mapping info to SAM as "Communication with subscription manager failed with code 500: undefined local variable or method `hypervisor' for #<Class:0x000000055ee1b0>"

Version-Release number of selected component (if applicable):
virt-who-0.16-7.el6.noarch
subscription-manager-1.16.8-5.el6.x86_64
python-rhsm-1.16.6-1.el6.x86_64

How reproducible:
20%

Steps to Reproduce:
1. Register system to SAM
2. Configure virt-who run at esx mode and restart virt-who,check virt-who's log.
[root@dell-per310-01 product]# cat /etc/sysconfig/virt-who  | grep -v ^# | grep -v ^$
VIRTWHO_DEBUG=1
VIRTWHO_ESX=1
VIRTWHO_ESX_OWNER=ACME_Corporation
VIRTWHO_ESX_ENV=Library
VIRTWHO_ESX_SERVER=10.66.79.5
VIRTWHO_ESX_USERNAME=administrator
VIRTWHO_ESX_PASSWORD=qwer1234P!
[root@dell-per310-01 product]# service virt-who restart && tail -f /var/log/rhsm/rhsm.log
[root@dell-per310-01 product]# service virt-who restart
Stopping virt-who:                                         [  OK  ]
Starting virt-who:                                         [  OK  ]
..................
hosts-to-guests mapping for config "env/cmdline": 2 hypervisors and 2 guests found
2016-03-17 01:48:39,614 [virtwho.main DEBUG] MainProcess(5675):MainThread @subscriptionmanager.py:hypervisorCheckIn:186 - Host-to-guest mapping: {
    "aee4ff00-8c33-11e2-994a-6c3be51d959a": [
        {
            "guestId": "42092ca4-1f26-bf00-b9c9-593e3b41abda", 
            "state": 5, 
            "attributes": {
                "active": 0, 
                "hypervisorVersion": "6.0.0", 
                "virtWhoType": "esx", 
                "hypervisorType": "VMware ESXi"
            }
        }, 
        {
            "guestId": "4209a518-e1de-ecf2-6625-faacc5b052c2", 
            "state": 5, 
            "attributes": {
                "active": 0, 
                "hypervisorVersion": "6.0.0", 
                "virtWhoType": "esx", 
                "hypervisorType": "VMware ESXi"
            }
        }
    ], 
    "86b2bd00-8bad-11e2-87f4-6c3be514699d": []
}
2016-03-17 01:48:40,505 [virtwho.main ERROR] MainProcess(5675):MainThread @virtwho.py:send:203 - Unable to send data: Communication with subscription manager failed with code 500: undefined local variable or method `hypervisor' for #<Class:0x0000000585dd60>

Actual results:
Virt-who can't send host/guest mapping info to SAM as "500 error" with subscription-manager

Expected results:
Virt-who can send host/guest mapping info to SAM, it shouldn't show any error info in the log.

Additional info:

Comment 1 Radek Novacek 2016-03-17 07:43:03 UTC
This is a bug in candlepin. The error: "undefined local variable or method `hypervisor' for #<Class:0x0000000585dd60>" is returned from hypervisorCheckIn API call together with error code 500.

Comment 2 Barnaby Court 2016-03-17 19:00:21 UTC
Please attach the candlepin log files & the virt-who log files showing when this occurs. Thanks!

Comment 3 Liushihui 2016-03-18 01:58:51 UTC
Created attachment 1137642 [details]
virtwho_candlepin_log

Comment 4 Liushihui 2016-03-18 01:59:19 UTC
Please see virtwho and candlepin log in attachment.

Comment 5 William Poteat 2016-03-23 11:53:08 UTC
Based on the log it would appear that you are running more that one virt-who instance. The error seems to occur when the timing causes two concurrent updates. It also appears that you are running synchronously. 

Can you confirm this?

Comment 6 Liushihui 2016-03-24 02:40:01 UTC
Yes, there are two virt-who instance monitor the vcenter and send h/g mapping info to candlepin.

Comment 7 Michael Stead 2017-08-01 19:02:19 UTC
SAM is no longer supported. We will only be addressing security related issues only.