Bug 1638814

Summary: cpu sockets for hypervisors are not available in Satellite
Product: Red Hat Satellite Reporter: Kenny Tordeurs <ktordeur>
Component: Subscription ManagementAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED DUPLICATE QA Contact: Katello QA List <katello-qa-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.3.3CC: bcourt, egolov, katello-qa-list, ktordeur
Target Milestone: UnspecifiedKeywords: Regression, Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1638812 Environment:
Last Closed: 2018-11-26 18:33:04 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 Kenny Tordeurs 2018-10-12 13:50:35 UTC
Description of problem:
virt-who is sending the cpu sockets:
~~~
2018-10-12 15:18:34,395 [virtwho.main INFO] MainProcess(1535):Thread-2 @virt.py:_send_data:922 - Report for config "vcenter" gathered, placing in datastore
2018-10-12 15:18:36,552 [virtwho.main INFO] MainProcess(1535):Thread-3 @virt.py:_send_data:922 - Report for config "satotest" gathered, placing in datastore
{
    "hypervisors": [
        {
            "facts": {
                "cpu.cpu_socket(s)": "2",
                "hypervisor.type": "VMware ESXi",
                "hypervisor.version": "6.0.0"
            },
~~~

However no sockets are being reported in Satellite:
# curl -s -u $user:$password -k https://$satellite/api/v2/hosts/$host_id/| python -m json.tool | grep "socket(s)"

Sockets count for hypervisor should be included:
https://bugzilla.redhat.com/show_bug.cgi?id=1307024

Version-Release number of selected component (if applicable):
satellite-6.3.3-2.el7sat.noarch

How reproducible:
100%

Steps to Reproduce:
1. Setup virt-who to report hypervisors
2. Verify cpu socket count in Satellite
3.

Actual results:
No cpu socket count 

Expected results:
see cpu socket count

Additional info:

Comment 1 Brad Buckingham 2018-10-12 14:59:43 UTC
*** Bug 1638812 has been marked as a duplicate of this bug. ***

Comment 5 Kenny Tordeurs 2018-10-15 09:03:49 UTC
I looked a bit deeper into this and I believe it's caused because of the following:

#######
CPU count is available in candlepin:

[root@provisioning ~]# su - postgres -c "psql candlepin -c \"select * from cp_consumer where name='vmvisor1.gsslab.brq2.redhat.com' ;"\"""
                id                |          created           |          updated           | autoheal | entitlementstatus |              name               | servicelevel |   username    |                 uuid 
                | environment_id | consumer_idcert_id | keypair_id |             owner_id             | type_id | releasever |                       compliancestatushash                       |        lastchecki
n         | annotations | cont_acc_cert_id | content_access_mode | entitlement_count | recipient_owner_key 
----------------------------------+----------------------------+----------------------------+----------+-------------------+---------------------------------+--------------+---------------+----------------------
----------------+----------------+--------------------+------------+----------------------------------+---------+------------+------------------------------------------------------------------+------------------
----------+-------------+------------------+---------------------+-------------------+---------------------
 4028ef816668485c016668604f170004 | 2018-10-12 15:03:54.135+02 | 2018-10-12 15:09:45.699+02 | t        | valid             | vmvisor1.gsslab.brq2.redhat.com | Self-Support | foreman_admin | 2a0779f1-3735-4335-ad
f2-846da90a0e8e |                |                    |            | 4028ef8153198e100153198f8d470001 | 1004    |            | 4f2568fb098d97cd0089cff1ddf3f5f1aaddae6194b541a7b89662b9c7ca9ecc | 2018-10-12 15:05:
29.341+02 |             |                  |                     |                 0 | 
(1 row)

[root@provisioning ~]# su - postgres -c "psql candlepin -c \"select * from cp_consumer_facts where cp_consumer_id='4028ef816668485c016668604f170004';"\"""
          cp_consumer_id          |   element   |       mapkey       
----------------------------------+-------------+--------------------
 4028ef816668485c016668604f170004 | VMware ESXi | hypervisor.type
 4028ef816668485c016668604f170004 | 2           | cpu.cpu_socket(s)
 4028ef816668485c016668604f170004 | 6.0.0       | hypervisor.version
(3 rows)


#######

The cpu count that is shown in the webui and API call is coming from foreman db:

# su - postgres -c "psql foreman -c \"select * from fact_names where name like '%cpu_socket(s)%';"\"""
~~~
256 | cpu::cpu_socket(s)                 | 2016-07-30 13:38:27.649622 | 2016-07-30 13:38:27.649622 | f       | cpu_socket(s)      | Katello::RhsmFactName | 200
266 | lscpu::socket(s)                   | 2016-07-30 13:38:27.958328 | 2016-07-30 13:38:27.958328 | f       | socket(s)          | Katello::RhsmFactName | 165
~~~

Example for some host:
select value from fact_values where host_id=239 and (fact_name_id=256 OR fact_name_id=266);
~~~
 id   | value | fact_name_id | host_id |         updated_at         |         created_at         
-------+-------+--------------+---------+----------------------------+----------------------------
 19111 | 6     |          256 |     239 | 2017-01-12 13:34:23.36352  | 2017-01-10 14:22:02.557855
 19108 | 6     |          266 |     239 | 2017-01-12 13:34:23.362563 | 2017-01-10 14:22:02.552852
~~~

Also confirmed with API call:

curl -s -u $user:$password -k https://$satellite/api/v2/hosts/$host_id/| python -m json.tool | grep "socket(s)"
~~~
Sockets for  239 :
        "cpu::cpu_socket(s)": "6",
        "lscpu::socket(s)": "6",
~~~

#########

So for hypervisors the foreman db does not contain any facts about the CPU count so it's not available via API call or in the webui

~~~
Content Host Properties
- OS
- Architecture
- Number of CPUs
- Sockets
- Cores per Socket
- RAM (GB) => NaN
- Virtual Guest => No

This can be quite confusing when a customer needs to be compliant and is unable to easily determine how many cpu sockets are in the system via webui.

Comment 6 Barnaby Court 2018-10-15 15:40:28 UTC
Moving to the subscription management component as the issue is in the foreman DB per comment 5.