Bug 1295654

Summary: "RestlibException: Access denied" when run virt-who with rhsm_username and rhsm_password
Product: Red Hat Enterprise Linux 6 Reporter: Eko <hsun>
Component: virt-whoAssignee: Radek Novacek <rnovacek>
Status: CLOSED DUPLICATE QA Contact: Eko <hsun>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.8CC: ovasik, rbalakri, sgao, shihliu
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: 2016-01-05 06:55:34 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-01-05 06:34:14 UTC
Description of problem:
configure virt-who with rhsm_username and rhsm_password option for remote libvirt mode,  virt-who can't work and show the error message as: "RestlibException: Access denied" 

Version-Release number of selected component (if applicable):
virt-who-0.16-1.el6.noarch

How reproducible:
always

Steps to Reproduce:
1. configure virt-who with rhsm_username and rhsm_password, such as:
# cat libvirt.conf 
[test-libvirt]
type=libvirt
server=10.66.144.8
username=root
password=redhat
owner=ACME_Corporation
env=Library
rhsm_username=admin
rhsm_password=admin

[Note] the rhsm_username and rhsm_password is used for satellite account.

2. restart virt-who service
# /etc/init.d/virt-who restart

3. check the rhsm.log
2016-01-05 14:31:22,376 [virtwho.init DEBUG] MainProcess(26104):MainThread @virtwho.py:__init__:144 - Using config named 'test-libvirt'
2016-01-05 14:31:22,376 [virtwho.init INFO] MainProcess(26104):MainThread @virtwho.py:main:811 - Using configuration "test-libvirt" ("libvirt" mode)
2016-01-05 14:31:22,394 [virtwho.main DEBUG] MainProcess(26106):MainThread @virtwho.py:run:287 - Starting infinite loop with 60 seconds interval
2016-01-05 14:31:22,480 [virtwho.test-libvirt DEBUG] Libvirtd-1(26114):MainThread @virt.py:run:338 - Virt backend 'test-libvirt' started
2016-01-05 14:31:22,482 [virtwho.test-libvirt INFO] Libvirtd-1(26114):MainThread @libvirtd.py:_get_url:124 - Protocol is not specified in libvirt url, using qemu+ssh://
2016-01-05 14:31:22,482 [virtwho.test-libvirt INFO] Libvirtd-1(26114):MainThread @libvirtd.py:_get_url:135 - Libvirt path is not specified in the url, using /system
2016-01-05 14:31:22,483 [virtwho.test-libvirt INFO] Libvirtd-1(26114):MainThread @libvirtd.py:_connect:156 - Using libvirt url: qemu+ssh://root.144.8/system?no_tty=1
2016-01-05 14:31:22,782 [virtwho.test-libvirt DEBUG] Libvirtd-1(26114):MainThread @libvirtd.py:_listDomains:228 - Virtual machine found: rhel7.2-satellite: 8d3f130d-b8f5-4b5e-3a3b-5d07483a615c
2016-01-05 14:31:22,788 [virtwho.test-libvirt DEBUG] Libvirtd-1(26114):MainThread @libvirtd.py:_listDomains:234 - Virtual machine found: rhel7.2: cb33ddce-fd1e-0e6a-7e7f-d3c6fca67ede
2016-01-05 14:31:22,789 [virtwho.test-libvirt DEBUG] Libvirtd-1(26114):MainThread @libvirtd.py:_listDomains:238 - Libvirt domains found: 8d3f130d-b8f5-4b5e-3a3b-5d07483a615c, cb33ddce-fd1e-0e6a-7e7f-d3c6fca67ede
2016-01-05 14:31:22,789 [virtwho.test-libvirt DEBUG] Libvirtd-1(26114):MainThread @virt.py:enqueue:331 - Report gathered, putting to queue for sending
2016-01-05 14:31:22,793 [virtwho.main DEBUG] MainProcess(26106):MainThread @virtwho.py:update_report_to_send:274 - Report for config "test-libvirt" updated
2016-01-05 14:31:22,800 [virtwho.main DEBUG] MainProcess(26106):MainThread @subscriptionmanager.py:_connect:108 - Authenticating with RHSM username admin
2016-01-05 14:31:23,013 [virtwho.main DEBUG] MainProcess(26106):MainThread @subscriptionmanager.py:hypervisorCheckIn:149 - Checking if server has capability 'hypervisor_async'
2016-01-05 14:31:23,193 [virtwho.main DEBUG] MainProcess(26106):MainThread @subscriptionmanager.py:hypervisorCheckIn:161 - Server does not have 'hypervisors_async' capability
2016-01-05 14:31:23,193 [virtwho.main INFO] MainProcess(26106):MainThread @subscriptionmanager.py:hypervisorCheckIn:170 - Sending update in hosts-to-guests mapping: 1 hypervisors and 2 guests found
2016-01-05 14:31:23,194 [virtwho.main DEBUG] MainProcess(26106):MainThread @subscriptionmanager.py:hypervisorCheckIn:171 - Host-to-guest mapping: {
    "80804c56-82fb-e111-a260-b4b52fcb471e": [
        {
            "guestId": "8d3f130d-b8f5-4b5e-3a3b-5d07483a615c", 
            "state": 1, 
            "attributes": {
                "active": 1, 
                "hypervisorVersion": "0.12.1", 
                "virtWhoType": "libvirt", 
                "hypervisorType": "QEMU"
            }
        }, 
        {
            "guestId": "cb33ddce-fd1e-0e6a-7e7f-d3c6fca67ede", 
            "state": 5, 
            "attributes": {
                "active": 0, 
                "hypervisorVersion": "0.12.1", 
                "virtWhoType": "libvirt", 
                "hypervisorType": "QEMU"
            }
        }
    ]
}
2016-01-05 14:31:23,353 [virtwho.main ERROR] MainProcess(26106):MainThread @subscriptionmanager.py:hypervisorCheckIn:185 - Communication with server failed:
Traceback (most recent call last):
  File "/usr/share/virt-who/manager/subscriptionmanager/subscriptionmanager.py", line 174, in hypervisorCheckIn
    result = self.connection.hypervisorCheckIn(config.owner, config.env, serialized_mapping, options=options)  # pylint:disable=unexpected-keyword-arg
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 918, in hypervisorCheckIn
    res = self.conn.request_post(url, host_guest_mapping)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 657, in request_post
    return self._request("POST", method, params)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 571, in _request
    self.validateResponse(result, request_type, handler)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 621, in validateResponse
    raise RestlibException(response['status'], error_msg, response.get('headers'))
RestlibException: Access denied
2016-01-05 14:31:23,355 [virtwho.main ERROR] MainProcess(26106):MainThread @virtwho.py:send:228 - Unable to send data: Communication with subscription manager failed: Access denied


Actual results:
virt-who can't work and show the error message as: "RestlibException: Access denied" 

Expected results:
virt-who should work normally with rhsm_username and rhsm_password options

Additional info:

Comment 2 Eko 2016-01-05 06:55:34 UTC

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