Bug 1403122

Summary: Failed to send mapping info to SAM when run virt-who with rhsm_username and rhsm_password
Product: [Retired] Subscription Asset Manager Reporter: Liushihui <shihliu>
Component: katelloAssignee: Katello Bug Bin <katello-bugs>
Status: CLOSED WONTFIX QA Contact: SAM QE List <sam-qe-list>
Severity: high Docs Contact:
Priority: unspecified    
Version: 1.4.1CC: bkearney, david.descamps, hsun, khowell, ktordeur, sgao
Target Milestone: rcFlags: khowell: needinfo? (bkearney)
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-06-26 20:40:12 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:
Bug Depends On:    
Bug Blocks: 1426104    

Description Liushihui 2016-12-09 06:19:05 UTC
Description of problem:
When run virt-who with rhsm_username and rhsm_password to SAM, it will show "nable to send data: Communication with subscription manager failed with code 403: User admin is not allowed to access api/v1/systems/hypervisors_update"

Version-Release number of selected component (if applicable):
SAM-1.4.1-RHEL-6-20141113.0
virt-who-0.18-1.el6.noarch
subscription-manager-1.18.5-1.el6.x86_64
python-rhsm-1.18.5-1.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Configure virt-who run at esx mode and run it with correct rhsm_username and rhsm_password to register to SAM
(use this username and password can login to SAM)

[root@lenovo-rd230-02 ~]# cat /etc/virt-who.d/virt 
[esx]
type=esx
server=10.73.131.239
username=administrator
password=Welcome1!
owner=ACME_Corporation
env=Library
rhsm_username=admin
rhsm_password=admin

2. Restart virt-who and check virt-who's log
[root@lenovo-rd230-02 ~]# service virt-who restart && tail -f /var/log/rhsm/rhsm.log
.......
2016-12-09 01:12:50,723 [virtwho.main INFO] MainProcess(14321):MainThread @subscriptionmanager.py:hypervisorCheckIn:195 - Sending update in hosts-to-guests mapping for config "esx": 1 hypervisors and 3 guests found
2016-12-09 01:12:50,723 [virtwho.main DEBUG] MainProcess(14321):MainThread @subscriptionmanager.py:hypervisorCheckIn:196 - Host-to-guest mapping: {
    "56c74d56-46fc-38ad-bdba-c1d306f95d0b": [
        {
            "guestId": "564d7c90-0a8e-bf52-a2c2-0c43ef2d6d92", 
            "state": 5, 
            "attributes": {
                "active": 0, 
                "virtWhoType": "esx"
            }
        }, 
        {
            "guestId": "564d82f9-4f88-e6ca-62e7-b0f676fed079", 
            "state": 5, 
            "attributes": {
                "active": 0, 
                "virtWhoType": "esx"
            }
        }, 
        {
            "guestId": "564dad75-1751-af6f-7c9a-5e6a186c90da", 
            "state": 5, 
            "attributes": {
                "active": 0, 
                "virtWhoType": "esx"
            }
        }
    ]
}
2016-12-09 01:12:53,093 [virtwho.main ERROR] MainProcess(14321):MainThread @executor.py:send:144 - Unable to send data: Communication with subscription manager failed with code 403: User admin is not allowed to access api/v1/systems/hypervisors_update
2016-12-09 01:12:53,093 [virtwho.main DEBUG] MainProcess(14321):MainThread @executor.py:send_report:109 - Report from "esx" failed to sent

Actual results:
Failed to send host/guest mapping info to SAM as "Unable to send data: Communication with subscription manager failed with code 403: User admin is not allowed to access api/v1/systems/hypervisors_update
"

Expected results:
virt-who should send mapping info to SAM when run it with correct rhsm_username and rhsm_password

Additional info:
It hasn't this problem on satellite6.2, please see  https://bugzilla.redhat.com/show_bug.cgi?id=1229235

Comment 1 David Descamps 2017-03-01 18:21:05 UTC
Hello,

After poking arround in the code, I've found that replacing

        :hypervisors_update               => consumer_only,
with
        :hypervisors_update               => register_system,

in file /usr/share/katello/app/controllers/api/v1/systems_controller.rb

seems to allow virt-who to register hypervisors correctly.

This seems logical to me, as SAM does not have the "consumer" system present in Satelitte.

Can someone from RedHat confirm that this "fix" is the right thing to do to correct this issue?

Comment 3 Bryan Kearney 2017-06-26 20:40:12 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!