Bug 1824183

Summary: Virtual host get counted as physical hosts on cloud.redhat.com
Product: Red Hat Satellite Reporter: Parag Kamble <pakamble>
Component: RH Cloud - InventoryAssignee: Ron Lavi <rlavi>
Status: CLOSED ERRATA QA Contact: Mirek Długosz <mzalewsk>
Severity: high Docs Contact:
Priority: high    
Version: 6.6.0CC: bkearney, egolov, jjeffers, khowell, pcreech, rlavi, sjagtap
Target Milestone: 6.8.0Keywords: Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: tfm-rubygem-foreman_rh_cloud-1.0.6 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1824308 1862259 (view as bug list) Environment:
Last Closed: 2020-10-27 13:01:20 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:
Bug Depends On:    
Bug Blocks: 1824308    
Attachments:
Description Flags
CPU Socket graph none

Description Parag Kamble 2020-04-15 13:54:56 UTC
Created attachment 1679068 [details]
CPU Socket graph

Description of problem:
When satellite inventory is uploaded to cloud all virtual hosts in the inventory is get counted in physical host and virtual hosts count remains zero. 

Version-Release number of selected component (if applicable):

Satellite Version : 6.6.3

How reproducible:


Steps to Reproduce:
1. attach some virtual and some physical hosts to satellite (2 physical and 2 virtual hosts).
2. upload inventory data to the cloud. 
3. verify host inventory is get updated correctly specially count GET api/inventory/v1/hosts.
4. verify CPU socket usage graph there should be correct physical and virtual count but after observation there is no virtual hosts get added and all host are considered as physical. 

Actual results:
4 sockets from physical hosts and 2 sockets for virtual hosts should have added


Expected results:
6 socket  has added in Physical hosts

Additional info:

Virtual hosts facts:

[root@kvm-04-guest10 ~]#  subscription-manager facts | grep -i is_guest
virt.is_guest: True

[root@kvm-04-guest10 ~]# hostname
kvm-04-guest10.hv2.lab.eng.bos.redhat.com


Yupana results doesn't include IS_VIRTUAL flag.

{

    "display_name":"kvm-04-guest10.hv2.lab.eng.bos.redhat.com",
    "fqdn":"kvm-04-guest10.hv2.lab.eng.bos.redhat.com",
    "account":"6291899",
    "subscription_manager_id":"9ccb5d75-a366-4469-908e-6574e9756960",
    "satellite_id":"9ccb5d75-a366-4469-908e-6574e9756960",
    "bios_uuid":"e0322ea1-0ebb-4866-a842-7c9bdcfe1e84",
    "vm_uuid":"e0322ea1-0ebb-4866-a842-7c9bdcfe1e84",
    "ip_addresses":[
        "10.16.56.77"
    ],
    "mac_addresses":[
        "52:54:00:50:04:10"
    ],
    "system_profile":{
        "number_of_cpus":1,
        "number_of_sockets":1,
        "cores_per_socket":1,
        "system_memory_bytes":3973660672,
        "network_interfaces":[
            {
                "ipv4_addresses":[
                    "10.16.56.77"
                ],
                "ipv6_addresses":[
                ],
                "mac_address":"52:54:00:50:04:10",
                "name":"eth0"
            }
        ],
        "bios_vendor":"Seabios",
        "bios_version":"0.5.1",
        "bios_release_date":"01/01/2011",
        "cpu_flags":[],
        "os_release":"Red Hat Enterprise Linux Server",
        "os_kernel_version":"3.10.0-1062.el7.x86_64",
        "arch":"x86_64",
        "subscription_status":"Fully entitled",
        "katello_agent_running":false,
        "satellite_managed":true,
        "installed_products":[
            {
                "name":"Red Hat Enterprise Linux Server",
                "id":"69"
            }
        ],
        "installed_packages":[]
    },
    "facts":[
        {
            "namespace":"satellite",
            "facts":{
                "satellite_version":"6.6.3",
                "system_purpose_usage":"",
                "system_purpose_role":"",
                "distribution_version":"7.7",
                "organization_id":1
            }
        }
    ],
    "tags":[
        {
            "namespace":"satellite",
            "key":"organization_id",
            "value":"1"
        }
    ]

},

Comment 3 Kevin Howell 2020-04-15 19:13:11 UTC
System profile's "infrastructure_type" field should be reported as "virtual" or "physical" based on the virt.is_guest fact. Without this change, the overall total can still be accurate (with a tally workaround), but physical/virtual counts will be inaccurate.

Regardless, there are a couple of tally changes that need to be implemented; I will clone this card to component Subscription Watch" for that purpose.

Comment 4 Kevin Howell 2020-04-15 19:32:49 UTC
> Without this change, the overall total can still be accurate (with a tally workaround), but physical/virtual counts will be inaccurate.

I considered the workaround (which would be to use hypervisor-guest mappings to infer whether a system is virtual), but it's insufficient to make the total completely accurate, as it doesn't correctly identify guests where for some reason the hypervisor-guest mappings are not reported, so I think it's better to go ahead and pursue a full solution as described in comment 3 (set infrastructure_type).

Comment 7 Mirek Długosz 2020-06-18 13:07:01 UTC
Verified that "infrastructure_type" field is present in report json, with values "physical" and "virtual". Value is decided based on "virt::is_guest" value.
Only Satellite-side changes were verified. I believe subscription watch QE team verified cloud.rh.com side back when we tested plugin 1.0.6 for Satellite 6.7.1 release.

Tested on:
Satellite 6.8.0 snap 5
pulp-server-2.21.2-1.el7sat.noarch
satellite-6.8.0-0.4.beta.el7sat.noarch
foreman-2.1.0-0.20.rc2.el7sat.noarch
katello-3.16.0-0.3.rc1.el7sat.noarch
tfm-rubygem-foreman_rh_cloud-2.0.7-1.el7sat.noarch

Comment 8 James Jeffers 2020-08-03 14:50:18 UTC
*** Bug 1862259 has been marked as a duplicate of this bug. ***

Comment 11 errata-xmlrpc 2020-10-27 13:01:20 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: Satellite 6.8 release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:4366