Bug 2083642

Summary: subscription-manager should not try to gather cloud metadata, when there is not strong sign that the VM is running in public cloud
Product: Red Hat Enterprise Linux 9 Reporter: Rehana <redakkan>
Component: subscription-managerAssignee: candlepin-bugs
Status: CLOSED ERRATA QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: medium Docs Contact:
Priority: high    
Version: 9.0CC: cdonnell, hlawatschek, jhnidek, jpasqual, jsefler, redakkan, rhsm-qe, shivagup, tharring, zpetrace
Target Milestone: rcKeywords: Triaged
Target Release: 9.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: subscription-manager-1.29.29-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 2057053 Environment:
Last Closed: 2022-11-15 11:19:30 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: 2057053    
Bug Blocks:    

Comment 1 Zdenek Petracek 2022-05-16 11:45:01 UTC
Reproducing the bug:

[root@muflon-3 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 3.2.22-1
subscription management rules: 5.41
subscription-manager: 1.29.26-3.el9_0


printing communication between SUBMAN and the server:
[root@muflon-3 ~]# export SUBMAN_DEBUG_PRINT_REQUEST=1
[root@muflon-3 ~]# export SUBMAN_DEBUG_PRINT_REQUEST_HEADER=1
[root@muflon-3 ~]# export SUBMAN_DEBUG_PRINT_REQUEST_BODY=1
[root@muflon-3 ~]# export SUBMAN_DEBUG_PRINT_RESPONSE=1


mimicking hyperV environment:
[root@muflon-3 ~]# nano /etc/rhsm/facts/hyperv.facts

{
  "dmi.chassis.manufacturer": "microsoft",
  "virt.host_type": "hyperv",
  "virt.is_guest": true
}

checking if system will try to reach metadata server:
[root@muflon-3 ~]# 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): 4
cpu.cpu_socket(s): 4
cpu.thread(s)_per_core: 1
cpu.topology_source: kernel /sys cpu sibling lists
distribution.id: Plow
distribution.name: Red Hat Enterprise Linux
distribution.version: 9.1
distribution.version.modifier: Unknown

...

--> system tried to reach metadata server

Pre-verification:
pre-veriying on version:

[root@muflon-3 ~]# subscription-manager version
...
server type: This system is currently not registered.
subscription management server: 3.2.22-1
subscription management rules: 5.41
subscription-manager: 1.29.26+117.g81026383e-1.git.0.c0ede25


checking if system will try to reach metadata server:
[root@muflon-3 ~]# subscription-manager facts
cpu.core(s)_per_socket: 1
cpu.cpu(s): 4
cpu.cpu_socket(s): 4
cpu.thread(s)_per_core: 1
cpu.topology_source: kernel /sys cpu sibling lists
distribution.id: Plow
distribution.name: Red Hat Enterprise Linux
distribution.version: 9.1
distribution.version.modifier: Unknown

...

--> system didn't try to reach metadata server = pre-verification PASSED

Comment 4 Zdenek Petracek 2022-07-25 10:30:25 UTC
Final verification:

Version:
[root@kvm-02-guest09 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 4.0.18-2
subscription management rules: 5.41
subscription-manager: 1.29.29-1.el9

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

printing communication between SUBMAN and the server:
[root@kvm-02-guest09 ~]# export SUBMAN_DEBUG_PRINT_REQUEST=1
[root@kvm-02-guest09 ~]# export SUBMAN_DEBUG_PRINT_REQUEST_HEADER=1
[root@kvm-02-guest09 ~]# export SUBMAN_DEBUG_PRINT_REQUEST_BODY=1
[root@kvm-02-guest09 ~]# export SUBMAN_DEBUG_PRINT_RESPONSE=1


[root@kvm-02-guest09 ~]# 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: Plow
distribution.name: Red Hat Enterprise Linux
distribution.version: 9.1
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
^^ system didn't tried to reach metadata = Verification PASSED

Comment 6 errata-xmlrpc 2022-11-15 11:19:30 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-2022:8341

Comment 7 Rehana 2022-12-13 13:36:43 UTC
*** Bug 2151961 has been marked as a duplicate of this bug. ***