Bug 1016990

Summary: Rhevm mode:RestlibException appeared in the virt-who log when migrate guest
Product: Red Hat Enterprise Linux 6 Reporter: Liushihui <shihliu>
Component: virt-whoAssignee: Radek Novacek <rnovacek>
Status: CLOSED DUPLICATE QA Contact: John Sefler <jsefler>
Severity: high Docs Contact:
Priority: high    
Version: 6.5CC: acathrow, liliu, ovasik, qianzhan, sgao
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-03-24 13:07:36 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 2013-10-09 06:11:38 UTC
Description of problem:
During test the Rhel6.5 + Rhevm mode against SAM1.3, When migrate guest, it will pop up error message in the rhsm.log

Version-Release number of selected component (if applicable):
subscription-manager-1.9.7-1.el6.x86_64
python-rhsm-1.9.6-1.el6.x86_64
virt-who-0.8-9.el6.noarch
katello-headpin-1.4.3.19-1.el6sam_splice.noarch
candlepin-0.8.26-1.el6sam.noarch

How reproducible:
Always

Steps to Reproduce:
1. Prepare two RHEL6.5 hosts with latest subscription-manager and virt-who installed. 
Rhel host1 and host2 have been added to Rhevm, And host1 have one guest(vm1)
Our test env as the following:
Rhevm: 10.66.78.64
Rhel host 1: 10.66.100.109
Rhel host 2: 10.66.100.110

2.In the host1, Configure virt-who in rhevm mode as the following:
[root@hp-z220-03 ~]# cat /etc/sysconfig/virt-who 
    VIRTWHO_BACKGROUND=1
    # Enable debugging output.
    VIRTWHO_DEBUG=1
    VIRTWHO_INTERVAL=20
    VIRTWHO_RHEVM=1
    # Option for RHEVM mode
    VIRTWHO_RHEVM_OWNER=ACME_Corporation
    VIRTWHO_RHEVM_ENV=Library
    VIRTWHO_RHEVM_SERVER=https://10.66.78.46:443
    VIRTWHO_RHEVM_USERNAME=admin@internal
    VIRTWHO_RHEVM_PASSWORD=redhat

3.In the host1,retart virt-who service
[root@hp-z220-03 ~]# service virt-who restart
[root@hp-z220-03 ~]# service virt-who status
virt-who (pid  16175) is running...

4. Register the host1 and host2 to SAM server
# Subscription-manager register --username=admin --password=admin

5. Register the vm1 to SAM server
# Subscription-manager register --username=admin --password=admin

6. Monitor the rhsm log :
# tail -f /var/log/rhsm/rhsm.log

7. In the Rhevm's webUI, migrate the vm1 to host2, please see the rhsm.log in the Actually result.

Actual results:
2013-10-08 23:35:01,976 [DEBUG]  @subscriptionmanager.py:89 - Sending update in hosts-to-guests mapping: {'1948ec11-1a18-495a-bc5e-733f4de098a4': [], 'fc31f4db-dfa4-440e-94df-c0c74f913320': ['a25bc871-25af-44a8-8083-a3b321ad808e']}
2013-10-08 23:35:22,438 [DEBUG]  @subscriptionmanager.py:89 - Sending update in hosts-to-guests mapping: {'1948ec11-1a18-495a-bc5e-733f4de098a4': [], 'fc31f4db-dfa4-440e-94df-c0c74f913320': []}
2013-10-08 23:35:42,864 [DEBUG]  @subscriptionmanager.py:89 - Sending update in hosts-to-guests mapping: {'1948ec11-1a18-495a-bc5e-733f4de098a4': ['a25bc871-25af-44a8-8083-a3b321ad808e'], 'fc31f4db-dfa4-440e-94df-c0c74f913320': []}
2013-10-08 23:35:43,107 [ERROR]  @virt-who.py:212 - Error in communication with subscription manager, trying to recover:
Traceback (most recent call last):
  File "/usr/share/virt-who/virt-who.py", line 196, in _send
    result = self.subscriptionManager.hypervisorCheckIn(self.options.owner, self.options.env, virtualGuests)
  File "/usr/share/virt-who/subscriptionmanager.py", line 92, in hypervisorCheckIn
    return self.connection.hypervisorCheckIn(owner, env, mapping)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 738, in hypervisorCheckIn
    return self.conn.request_post(url, host_guest_mapping)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 544, in request_post
    return self._request("POST", method, params)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 469, in _request
    self.validateResponse(result, request_type, handler)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 511, in validateResponse
    raise RestlibException(response['status'], error_msg)
RestlibException: undefined local variable or method `hypervisor' for #<Class:0x000000062dd358>
2013-10-08 23:35:43,326 [DEBUG]  @subscriptionmanager.py:89 - Sending update in hosts-to-guests mapping: {'1948ec11-1a18-495a-bc5e-733f4de098a4': ['a25bc871-25af-44a8-8083-a3b321ad808e'], 'fc31f4db-dfa4-440e-94df-c0c74f913320': []}


Expected results:
It shouldn't pop up these error messages.It should only pop up the normally log messages after migrate succesfully as the following:
2013-10-08 23:35:43,326 [DEBUG]  @subscriptionmanager.py:89 - Sending update in hosts-to-guests mapping: {'1948ec11-1a18-495a-bc5e-733f4de098a4': ['a25bc871-25af-44a8-8083-a3b321ad808e'], 'fc31f4db-dfa4-440e-94df-c0c74f913320': []}


Additional info:

Comment 2 Radek Novacek 2013-10-09 06:46:10 UTC
(In reply to Liushihui from comment #0)
>     raise RestlibException(response['status'], error_msg)
> RestlibException: undefined local variable or method `hypervisor' for
> #<Class:0x000000062dd358>

This looks like server-side exception. It seems to came through the REST API. What candlepin (instance and version) did you use?

Comment 3 Liushihui 2013-10-09 07:12:34 UTC
(In reply to Radek Novacek from comment #2)
> (In reply to Liushihui from comment #0)
> >     raise RestlibException(response['status'], error_msg)
> > RestlibException: undefined local variable or method `hypervisor' for
> > #<Class:0x000000062dd358>
> 
> This looks like server-side exception. It seems to came through the REST
> API. What candlepin (instance and version) did you use?

I test with the SAM server(SAM version:SAM-1.3.1-RHEL-6-20131007.0),The candlepin version is candlepin-0.8.26-1.el6sam.noarch
SAM server IP:10.66.13.219 username/password: admin/admin

Comment 4 Liushihui 2013-10-12 07:44:40 UTC
Under the ESX mode, it has the same problem.

Comment 5 RHEL Program Management 2013-10-18 08:34:45 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 6 Radek Novacek 2014-03-24 13:07:36 UTC
This is not actual bug in virt-who. It seems that SAM is the cause of this issue.

*** This bug has been marked as a duplicate of bug 1004616 ***