Bug 2175823

Summary: subscription-manager should not try to gather cloud metadata, when there is not strong sign that the VM is running in public cloud [rhel-8.6.0.z]
Product: Red Hat Enterprise Linux 8 Reporter: RHEL Program Management Team <pgm-rhel-tools>
Component: subscription-managerAssignee: Pino Toscano <ptoscano>
Status: CLOSED ERRATA QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: medium Docs Contact:
Priority: high    
Version: 8.6CC: cdonnell, hlawatschek, jpasqual, jsefler, magoodwi, redakkan, sgajendr, shivagup, sshashi, thomas.zajic, zpetrace
Target Milestone: rcKeywords: Triaged, ZStream
Target Release: 8.6   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: subscription-manager-1.28.29.1-1.el8_6 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 2057053 Environment:
Last Closed: 2023-04-18 16:34:24 UTC Type: ---
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: 2057053    
Bug Blocks:    

Comment 1 Zdenek Petracek 2023-03-07 12:17:45 UTC
Reproducing the bug 
[root@kvm-01-guest18 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 4.2.15-1
subscription management rules: 5.43
subscription-manager: 1.28.25-1.el8

[root@kvm-01-guest18 ~]# export SUBMAN_DEBUG_PRINT_REQUEST=1
[root@kvm-01-guest18 ~]# export SUBMAN_DEBUG_PRINT_REQUEST_HEADER=1
[root@kvm-01-guest18 ~]# export SUBMAN_DEBUG_PRINT_REQUEST_BODY=1
[root@kvm-01-guest18 ~]# export SUBMAN_DEBUG_PRINT_RESPONSE=1

[root@kvm-01-guest18 ~]# cat /etc/rhsm/facts/hyperv.facts
{
  "dmi.chassis.manufacturer": "microsoft",
  "virt.host_type": "hyperv",
  "virt.is_guest": true
}

[root@kvm-01-guest18 ~]# subscription-manager facts

Making request: GET http://169.254.169.254/metadata/instance?api-version=2021-02-01 {User-Agent: cloud-what/1.0, Accept-Encoding: gzip, deflate, Accept: */*, Connection: keep-alive, Metadata: true}


Making request: GET http://169.254.169.254/metadata/versions {User-Agent: cloud-what/1.0, Accept-Encoding: gzip, deflate, Accept: */*, Connection: keep-alive, Metadata: true}

cpu.core(s)_per_socket: 1
cpu.cpu(s): 2
cpu.cpu_socket(s): 2
cpu.thread(s)_per_core: 1
cpu.topology_source: kernel /sys cpu sibling lists
distribution.id: Ootpa
distribution.name: Red Hat Enterprise Linux
distribution.version: 8.6
distribution.version.modifier: Unknown
dmi.bios.address: 0xe8000
dmi.bios.bios_revision: 1.0
dmi.bios.release_date: 01/01/2011
dmi.bios.rom_size: 64 KB
dmi.bios.runtime_size: 96 KB
dmi.bios.vendor: Seabios
^^ Bug reproduced


Verifying the patch
[root@kvm-01-guest18 src]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 4.2.15-1
subscription management rules: 5.43
subscription-manager: 1.28.29-3.git.7.f8ef4dc.el8_6

[root@kvm-01-guest18 ~]# export SUBMAN_DEBUG_PRINT_REQUEST=1
[root@kvm-01-guest18 ~]# export SUBMAN_DEBUG_PRINT_REQUEST_HEADER=1
[root@kvm-01-guest18 ~]# export SUBMAN_DEBUG_PRINT_REQUEST_BODY=1
[root@kvm-01-guest18 ~]# export SUBMAN_DEBUG_PRINT_RESPONSE=1

[root@kvm-01-guest18 ~]# subscription-manager facts
cpu.core(s)_per_socket: 1
cpu.cpu(s): 2
cpu.cpu_socket(s): 2
cpu.thread(s)_per_core: 1
cpu.topology_source: kernel /sys cpu sibling lists
distribution.id: Ootpa
distribution.name: Red Hat Enterprise Linux
distribution.version: 8.6
distribution.version.modifier: Unknown
dmi.bios.address: 0xe8000
dmi.bios.bios_revision: 1.0
dmi.bios.release_date: 01/01/2011
dmi.bios.rom_size: 64 KB
dmi.bios.runtime_size: 96 KB
dmi.bios.vendor: Seabios
dmi.bios.version: 0.5.1
dmi.chassis.asset_tag: Unknown
dmi.chassis.boot-up_state: Safe
dmi.chassis.lock: Not Present
dmi.chassis.manufacturer: microsoft
...
^^ system did not try to reach metadata server = patch works

Comment 5 Zdenek Petracek 2023-03-21 12:11:28 UTC
Reproducing the bug on the SM version:
[root@kvm-02-guest02 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 4.2.15-1
subscription management rules: 5.43
subscription-manager: 1.28.29-3.el8

[root@kvm-02-guest02 ~]# export SUBMAN_DEBUG_PRINT_REQUEST=1
[root@kvm-02-guest02 ~]# export SUBMAN_DEBUG_PRINT_REQUEST_HEADER=1
[root@kvm-02-guest02 ~]# export SUBMAN_DEBUG_PRINT_REQUEST_BODY=1
[root@kvm-02-guest02 ~]# export SUBMAN_DEBUG_PRINT_RESPONSE=1

[root@kvm-02-guest02 ~]# cat /etc/rhsm/facts/hyperv.facts
{
  "dmi.chassis.manufacturer": "microsoft",
  "virt.host_type": "hyperv",
  "virt.is_guest": true
}

[root@kvm-02-guest02 ~]# subscription-manager facts

Making request: GET http://169.254.169.254/metadata/instance?api-version=2021-02-01 {User-Agent: cloud-what/1.0, Accept-Encoding: gzip, deflate, Accept: */*, Connection: keep-alive, Metadata: true}


Making request: GET http://169.254.169.254/metadata/versions {User-Agent: cloud-what/1.0, Accept-Encoding: gzip, deflate, Accept: */*, Connection: keep-alive, Metadata: true}

cpu.core(s)_per_socket: 1
cpu.cpu(s): 1
cpu.cpu_socket(s): 1
cpu.thread(s)_per_core: 1
^^ Bug reproduced successfully, system tried to reach metadata server

Verification on SM version:
[root@kvm-02-guest02 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 4.2.15-1
subscription management rules: 5.43
subscription-manager: 1.28.29.1-1.el8_6

[root@kvm-02-guest02 ~]# subscription-manager facts
cpu.core(s)_per_socket: 1
cpu.cpu(s): 1
cpu.cpu_socket(s): 1
cpu.thread(s)_per_core: 1
cpu.topology_source: kernel /sys cpu sibling lists
distribution.id: Ootpa
distribution.name: Red Hat Enterprise Linux
distribution.version: 8.6
^^ System did not tried to reach metadata server ==> Verification PASSED

Comment 9 errata-xmlrpc 2023-04-18 16:34:24 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 (subscription-manager bug fix and enhancement update), 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/RHBA-2023:1840