Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1263048

Summary: [SAM] virt-who failed to communicate with subscription-manager as "RestlibException" when start/stop/add/delete/migrate guests in vcenter/hyperv/rhevm
Product: [Retired] Subscription Asset Manager Reporter: Liushihui <shihliu>
Component: candlepinAssignee: Katello Bug Bin <katello-bugs>
Status: CLOSED WONTFIX QA Contact: Eko <hsun>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.4.1CC: dmoessne, hsun, ldai, owwang, sgao, shihliu
Target Milestone: ---   
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-06-26 20:39:32 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 Liushihui 2015-09-15 02:57:20 UTC
Description of problem:
Add/delete guest on esx, virt-who will temporarily failed to communicate with subscription-manager as "RestlibException: undefined local variable or method `hypervisor' for #<Class:0x00000005813918>"

Version-Release number of selected component (if applicable):
python-rhsm-1.15.4-4.el7.x86_64
subscription-manager-1.15.9-7.el7.x86_64
virt-who-0.14-7.el7.noarch
SAM-1.4.1-RHEL-6-20141113.0

How reproducible:
Always

Steps to Reproduce:
1. Register system to SAM.
2. Configure virt-who run at esx mode
# grep -v  "^#" /etc/sysconfig/virt-who
VIRTWHO_BACKGROUND=1
VIRTWHO_DEBUG=1
VIRTWHO_INTERVAL=5
VIRTWHO_ESX=1
VIRTWHO_ESX_OWNER=ACME_Corporation
VIRTWHO_ESX_ENV=Library
VIRTWHO_ESX_SERVER=10.66.78.2
VIRTWHO_ESX_USERNAME=administrator
VIRTWHO_ESX_PASSWORD=qwer1234P!
3. Restart virt-who service 
# systemctl restart virt-who
4. In vcenter, add a guest, check the virt-who's log
5. In vcenter, delete a guest, check the virt-who's log
# tail -f /var/log/rhsm/rhsm.log

Actual results:
After step4 and step5, virt-who will temporarily failed to communicate with subscription-manager. please see the detail log as the following:
2015-09-15 10:40:03,968 [DEBUG]  @subscriptionmanager.py:112 - Authenticating with certificate: /etc/pki/consumer/cert.pem
2015-09-15 10:40:03,999 [DEBUG]  @subscriptionmanager.py:146 - Checking if server has capability 'hypervisor_async'
2015-09-15 10:40:04,031 [DEBUG]  @subscriptionmanager.py:158 - Server does not have 'hypervisors_async' capability
2015-09-15 10:40:04,031 [INFO]  @subscriptionmanager.py:165 - Sending update in hosts-to-guests mapping: {
    "93b45c80-28ec-11e2-87c4-b4b52fe0f08d": [], 
    "826c4f80-28ee-11e2-b149-b4b52fe0ce88": []
}
2015-09-15 10:40:06,865 [DEBUG]  @esx.py:142 - Waiting for ESX changes
2015-09-15 10:40:06,868 [DEBUG]  @subscriptionmanager.py:112 - Authenticating with certificate: /etc/pki/consumer/cert.pem
2015-09-15 10:40:06,898 [DEBUG]  @subscriptionmanager.py:146 - Checking if server has capability 'hypervisor_async'
2015-09-15 10:40:06,929 [DEBUG]  @subscriptionmanager.py:158 - Server does not have 'hypervisors_async' capability
2015-09-15 10:40:06,929 [INFO]  @subscriptionmanager.py:165 - Sending update in hosts-to-guests mapping: {
    "93b45c80-28ec-11e2-87c4-b4b52fe0f08d": [
        {
            "guestId": "422c92cb-14b2-e7a5-77fe-a530c7311de7", 
            "state": 5, 
            "attributes": {
                "active": 0, 
                "virtWhoType": "esx", 
                "hypervisorType": "vmware"
            }
        }
    ], 
    "826c4f80-28ee-11e2-b149-b4b52fe0ce88": []
}
2015-09-15 10:40:07,202 [ERROR]  @subscriptionmanager.py:171 - Communication with server failed:
Traceback (most recent call last):
  File "/usr/share/virt-who/manager/subscriptionmanager/subscriptionmanager.py", line 167, in hypervisorCheckIn
    result = self.connection.hypervisorCheckIn(config.owner, config.env, serialized_mapping)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 903, in hypervisorCheckIn
    res = self.conn.request_post(url, host_guest_mapping)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 647, in request_post
    return self._request("POST", method, params)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 564, in _request
    self.validateResponse(result, request_type, handler)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 611, in validateResponse
    raise RestlibException(response['status'], error_msg, response.get('headers'))
RestlibException: undefined local variable or method `hypervisor' for #<Class:0x00000005813918>
2015-09-15 10:40:07,203 [ERROR]  @virtwho.py:176 - Unable to send data: Communication with subscription manager failed with code 500: undefined local variable or method `hypervisor' for #<Class:0x00000005813918>

Expected results:
It shouldn't show any error info when update(add/delete/modify)guest in vcenter.

Additional info:

Comment 1 Radek Novacek 2015-09-15 07:59:44 UTC
The RestlibException suggest that the problem is in candlepin. Some error occured in the candlepin and the error info in sent back to the virt-who.

Reassigning to candlepin for investigation.

Comment 2 Liushihui 2015-09-15 08:48:59 UTC
It is only exist on SAM-1.4.1-RHEL-6-20141113.0, it is not exist on Satellite-6.1.0-RHEL-7-20150828.0. Therefore, move it to SAM.

Comment 3 Liushihui 2015-09-15 08:49:15 UTC
It is only exist on SAM-1.4.1-RHEL-6-20141113.0, it is not exist on Satellite-6.1.0-RHEL-7-20150828.0. Therefore, move it to SAM.

Comment 4 Liushihui 2015-09-16 03:47:54 UTC
Power off and Power on guest has the same problem.

Power off guest, it will show error info as the following:
2015-09-16 11:44:48,691 [ERROR]  @subscriptionmanager.py:171 - Communication with server failed:
Traceback (most recent call last):
  File "/usr/share/virt-who/manager/subscriptionmanager/subscriptionmanager.py", line 167, in hypervisorCheckIn
    result = self.connection.hypervisorCheckIn(config.owner, config.env, serialized_mapping)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 903, in hypervisorCheckIn
    res = self.conn.request_post(url, host_guest_mapping)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 647, in request_post
    return self._request("POST", method, params)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 564, in _request
    self.validateResponse(result, request_type, handler)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 611, in validateResponse
    raise RestlibException(response['status'], error_msg, response.get('headers'))
RestlibException: undefined local variable or method `hypervisor' for #<Class:0x00000005813918>
2015-09-16 11:44:48,691 [ERROR]  @virtwho.py:176 - Unable to send data: Communication with subscription manager failed with code 500: undefined local variable or method `hypervisor' for #<Class:0x00000005813918>


Power on guest ,it will show error as the following:
2015-09-16 11:45:27,834 [ERROR]  @subscriptionmanager.py:171 - Communication with server failed:
Traceback (most recent call last):
  File "/usr/share/virt-who/manager/subscriptionmanager/subscriptionmanager.py", line 167, in hypervisorCheckIn
    result = self.connection.hypervisorCheckIn(config.owner, config.env, serialized_mapping)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 903, in hypervisorCheckIn
    res = self.conn.request_post(url, host_guest_mapping)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 647, in request_post
    return self._request("POST", method, params)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 564, in _request
    self.validateResponse(result, request_type, handler)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 611, in validateResponse
    raise RestlibException(response['status'], error_msg, response.get('headers'))
RestlibException: undefined local variable or method `hypervisor' for #<Class:0x0000000612e728>
2015-09-16 11:45:27,835 [ERROR]  @virtwho.py:176 - Unable to send data: Communication with subscription manager failed with code 500: undefined local variable or method `hypervisor' for #<Class:0x0000000612e728>

Comment 5 Liushihui 2015-09-23 06:09:36 UTC
When virt-who run at hyperv mode, Start/stop/add/delete vm has the same problem

Comment 6 Eko 2015-10-13 06:18:32 UTC
this issue also can be duplicated for Stage candlepin, when start/stop/add/delete/migrate guests, virt-who will show the following error message:

2015-10-13 14:18:11,630 [ERROR]  @virtwho.py:190 - Error in communication with subscription manager:
Traceback (most recent call last):
  File "/usr/share/virt-who/virtwho.py", line 171, in send
    self._sendGuestList(report)
  File "/usr/share/virt-who/virtwho.py", line 196, in _sendGuestList
    manager.sendVirtGuests(report.guests)
  File "/usr/share/virt-who/manager/subscriptionmanager/subscriptionmanager.py", line 139, in sendVirtGuests
    self.connection.updateConsumer(self.uuid(), guest_uuids=serialized_guests)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 947, in updateConsumer
    ret = self.conn.request_put(method, params)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 653, in request_put
    return self._request("PUT", method, params)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 564, in _request
    self.validateResponse(result, request_type, handler)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 627, in validateResponse
    raise RateLimitExceededException(response['status'])
RateLimitExceededException

Comment 8 Liushihui 2016-04-01 08:23:48 UTC
It still exist on RHEL-6.8-20160330.0(kvm mode) against SAM-1.4.1-RHEL-6-20141113.0, when stop guest on hyperv ,it also show failed to communicate with subscription-manager, please see detail as the following:

2016-04-01 04:16:31,430 [virtwho.main DEBUG] MainProcess(2651):MainThread @subscriptionmanager.py:hypervisorCheckIn:186 - Host-to-guest mapping: {
    "564D80F1-61F0-8510-87BF-57F9EC6122D7": [
        {
            "guestId": "C877953C-A19E-5149-B614-D97873C4CBD2", 
            "state": 5, 
            "attributes": {
                "active": 0, 
                "hypervisorVersion": "6.3.9600.16404", 
                "virtWhoType": "hyperv", 
                "hypervisorType": "hyperv"
            }
        }, 
        {
            "guestId": "8329390B-8359-F646-9176-27D738580E81", 
            "state": 5, 
            "attributes": {
                "active": 0, 
                "hypervisorVersion": "6.3.9600.16404", 
                "virtWhoType": "hyperv", 
                "hypervisorType": "hyperv"
            }
        }
    ]
}
2016-04-01 04:16:32,169 [virtwho.main ERROR] MainProcess(2651):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:0x00000006180190>

Comment 9 Liushihui 2016-04-06 02:41:45 UTC
When it occurred this problem on RHEL-6.8-20160330.0(kvm mode) against SAM-1.4.1-RHEL-6-20141113.0, virt-who can't report the updating to SAM until restart virt-who.

Comment 10 Liushihui 2016-08-29 02:04:21 UTC
It still exist on RHEL-7.3-20160825.1 against SAM-1.4.1-RHEL-6-20141113.0.

Comment 12 Eko 2016-09-29 01:38:14 UTC
*** Bug 1379926 has been marked as a duplicate of this bug. ***

Comment 13 Liushihui 2016-12-20 02:21:31 UTC
It still exist on RHEL-6.9-20161216.1 against SAM-1.4.1-RHEL-6-20141113.0.

Comment 14 Liushihui 2017-05-08 07:12:57 UTC
It still exist on RHEL-7.4-20170504.0(virt-who-0.19-4.el7.noarch, subscription-manager-1.19.12-1.el7.x86_64) against  SAM-1.4.1-RHEL-6-20141113.0. It will show error info as the following:
2017-05-08 01:01:27,065 [virtwho.destination_-4276030173829136440 ERROR] MainProcess(23280):Thread-3 @virt.py:_send_data:593 - Error during hypervisor checkin: 
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/virtwho/virt/virt.py", line 584, in _send_data
    options=self.options)
  File "/usr/lib/python2.7/site-packages/virtwho/manager/subscriptionmanager/subscriptionmanager.py", line 221, in hypervisorCheckIn
    raise ManagerError("Communication with subscription manager failed with code %d: %s" % (e.code, str(e)))
ManagerError: Communication with subscription manager failed with code 500: undefined local variable or method `hypervisor' for #<Class:0x000000069f0140>
2017-05-08 01:01:30,673 [virtwho.env_cmdline INFO] MainProcess(23280):Thread-2 @virt.py:_send_data:833 - Report for config "env/cmdline" gathered, placing in datastore

Comment 15 Bryan Kearney 2017-06-26 20:39:32 UTC
The release of Satellite 5.8 we are deprecating the support of Subscription Asset Manager. The release notes for 5.8 can be found at https://access.redhat.com/documentation/en-us/red_hat_satellite/5.8/pdf/release_notes/Red_Hat_Satellite-5.8-Release_Notes-en-US.pdf.

I am therefore closing out this bug as WONTFIX. If you believe this to be an error, please feel free tor each out to either Rich Jerrido or Bryan Kearney. Thank you!