Bug 2097714

Summary: [rhevm] Failed to run the virt-who configured with unreachable http_proxy when set up the no_proxy and rhsm_no_proxy options
Product: Red Hat Enterprise Linux 8 Reporter: Kunxin Huang <kuhuang>
Component: virt-whoAssignee: candlepin-bugs
Status: CLOSED MIGRATED QA Contact: yuefliu <yuefliu>
Severity: medium Docs Contact:
Priority: low    
Version: 8.7CC: hsun, kuhuang, redakkan
Target Milestone: rcKeywords: MigratedToJIRA, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-10-10 10:21:53 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: 2089955    

Description Kunxin Huang 2022-06-16 11:35:35 UTC
Description of problem:
Only for rhevm hypervisor, failed to run the virt-who configured with unreachable http_proxy when set up the no_proxy=[hypervisor_server] and rhsm_no_proxy=[register_server]


Version-Release number of selected component (if applicable):
virt-who-1.30.12-1.el8.noarch
rhel8.7


How reproducible:
100%


Steps to Reproduce:
1. Create the virt-who config file in /etc/virt-who.d
[virtwho-config]
type=rhevm
server=[rhevm_server]
username=[username]
password=[password]
owner=[owner_id]

2. run the virt-who service by the command: service virt-who restart

3. virt-who runs normally

4. configure the unreachable http_prxoy in /etc/sysconfig/virt-who
http_proxy=http://10.73.3.xx:9999

5. configure the no_proxy=[rhevm_server] in /etc/sysconfig/virt-who
no_proxy=[rhevm_server]

6. configure the rhsm_no_proxy=[register_server] in /etc/virt-who.conf
[defaults]
rhsm_no_proxy=subscription.rhsm.stage.redhat.com

7. run the virt-who service by the command: service virt-who restart


Actual results:
virt-who shown the error message:
-----------------------------
2022-06-16 06:47:11,919 [virtwho.parser WARNING] MainProcess(137570):MainThread @parser.py:read_config_env_variables:237 - The use of environment variables and the use of the sysconfig file to configure virt-who are deprecated. Their use will be ignored in the next major release.
2022-06-16 06:47:11,923 [virtwho.rhsm_log DEBUG] MainProcess(137570):MainThread @config.py:init_config:1594 - [global]: Value for "oneshot" not set, using default: False
2022-06-16 06:47:11,923 [virtwho.rhsm_log DEBUG] MainProcess(137570):MainThread @config.py:init_config:1594 - [global]: Value for "print_" not set, using default: False
2022-06-16 06:47:11,923 [virtwho.rhsm_log DEBUG] MainProcess(137570):MainThread @config.py:init_config:1594 - [global]: Value for "log_per_config" not set, using default: False
2022-06-16 06:47:11,923 [virtwho.rhsm_log DEBUG] MainProcess(137570):MainThread @config.py:init_config:1594 - [global]: Value for "configs" not set, using default: []
2022-06-16 06:47:11,924 [virtwho.rhsm_log DEBUG] MainProcess(137570):MainThread @config.py:init_config:1594 - [global]: Value for "reporter_id" not set, using default: rhel-8-7-0-20220524-0-rhevm-59910.redhat.com-ba7c4251bb7241888c031f27cb5a3405
2022-06-16 06:47:11,924 [virtwho.rhsm_log DEBUG] MainProcess(137570):MainThread @config.py:init_config:1594 - [global]: Value for "interval" not set, using default: 3600
2022-06-16 06:47:11,924 [virtwho.rhsm_log DEBUG] MainProcess(137570):MainThread @config.py:init_config:1594 - [global]: Value for "log_file" not set, using default: rhsm.log
2022-06-16 06:47:11,924 [virtwho.rhsm_log DEBUG] MainProcess(137570):MainThread @config.py:init_config:1594 - [global]: Value for "log_dir" not set, using default: /var/log/rhsm
2022-06-16 06:47:11,924 [virtwho.rhsm_log DEBUG] MainProcess(137570):MainThread @config.py:init_config:1594 - [virtwho-config]: Value for "hypervisor_id" not set, using default: uuid
2022-06-16 06:47:11,924 [virtwho.rhsm_log INFO] MainProcess(137570):MainThread @config.py:init_config:1594 - [virtwho-config]: The original server URL was incomplete. It has been enhanced to https://bootp-73-131-193.rhts.eng.pek2.redhat.com:443/
2022-06-16 06:47:11,925 [virtwho.rhsm_log INFO] MainProcess(137570):MainThread @executor.py:__init__:54 - Using config named 'virtwho-config'
2022-06-16 06:47:11,925 [virtwho.rhsm_log INFO] MainProcess(137570):MainThread @main.py:main:176 - Using configuration "virtwho-config" ("rhevm" mode)
2022-06-16 06:47:11,925 [virtwho.rhsm_log INFO] MainProcess(137570):MainThread @main.py:main:178 - Using reporter_id='rhel-8-7-0-20220524-0-rhevm-59910.redhat.com-ba7c4251bb7241888c031f27cb5a3405'
2022-06-16 06:47:11,927 [virtwho.main DEBUG] MainProcess(137570):MainThread @executor.py:run:187 - Starting infinite loop with 3600 seconds interval
2022-06-16 06:47:11,940 [rhsm.https DEBUG] MainProcess(137570):MainThread @https.py:<module>:56 - Using standard libs to provide httplib and ssl
2022-06-16 06:47:11,949 [virtwho.main DEBUG] MainProcess(137570):Thread-2 @virt.py:run:407 - Thread 'virtwho-config' started
2022-06-16 06:47:11,954 [virtwho.destination_-515115144285168198 DEBUG] MainProcess(137570):Thread-3 @virt.py:run:407 - Thread 'destination_-515115144285168198' started
2022-06-16 06:47:11,958 [virtwho.main ERROR] MainProcess(137570):Thread-2 @virt.py:run:416 - Thread 'virtwho-config' fails with error: Unable to connect to RHEV-M server: HTTPSConnectionPool(host='bootp-73-131-193.rhts.eng.pek2.redhat.com', port=443): Max retries exceeded with url: /ovirt-engine/api/v4/clusters (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7ff001771d30>: Failed to establish a new connection: [Errno 111] Connection refused',)))
2022-06-16 06:47:11,959 [virtwho.main INFO] MainProcess(137570):Thread-2 @virt.py:_send_data:986 - Report for config "virtwho-config" gathered, placing in datastore
2022-06-16 06:47:11,960 [virtwho.main INFO] MainProcess(137570):Thread-2 @virt.py:run:440 - Waiting 3600 seconds before performing action again 'virtwho-config'
2022-06-16 06:47:12,956 [virtwho.destination_-515115144285168198 DEBUG] MainProcess(137570):Thread-3 @subscriptionmanager.py:_connect:152 - Authenticating with certificate: /etc/pki/consumer/cert.pem
2022-06-16 06:47:12,958 [rhsm.connection DEBUG] MainProcess(137570):Thread-3 @connection.py:__init__:173 - Environment variable NO_PROXY= will be used
2022-06-16 06:47:12,960 [rhsm.connection DEBUG] MainProcess(137570):Thread-3 @connection.py:__init__:268 - Connection built: http_proxy=10.73.3.24:9999 host=subscription.rhsm.stage.redhat.com port=443 handler=/subscription auth=identity_cert ca_dir=/etc/rhsm/ca/ insecure=0
2022-06-16 06:47:12,957 [virtwho.destination_-515115144285168198 INFO] MainProcess(137570):Thread-3 @subscriptionmanager.py:_connect:159 - X-Correlation-ID: 45e3a3e958a94520938176f4e0adf887
2022-06-16 06:47:12,963 [rhsm.connection DEBUG] MainProcess(137570):Thread-3 @connection.py:_request:728 - Making request: GET /subscription/status/
2022-06-16 06:47:12,966 [rhsm.connection DEBUG] MainProcess(137570):Thread-3 @connection.py:_create_connection:599 - Using proxy: 10.73.3.24:9999
2022-06-16 06:47:12,968 [virtwho.destination_-515115144285168198 ERROR] MainProcess(137570):Thread-3 @virt.py:run:421 - Thread 'destination_-515115144285168198' fails with exception:
Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 747, in _request
    conn.request(request_type, handler, body=body, headers=final_headers)
  File "/usr/lib64/python3.6/http/client.py", line 1273, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib64/python3.6/http/client.py", line 1319, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib64/python3.6/http/client.py", line 1268, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib64/python3.6/http/client.py", line 1044, in _send_output
    self.send(msg)
  File "/usr/lib64/python3.6/http/client.py", line 982, in send
    self.connect()
  File "/usr/lib64/python3.6/http/client.py", line 1433, in connect
    super().connect()
  File "/usr/lib64/python3.6/http/client.py", line 954, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib64/python3.6/socket.py", line 724, in create_connection
    raise err
  File "/usr/lib64/python3.6/socket.py", line 713, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:


Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/virtwho/virt/virt.py", line 412, in run
    self._run()
  File "/usr/lib/python3.6/site-packages/virtwho/virt/virt.py", line 368, in _run
    self._send_data(data_to_send)
  File "/usr/lib/python3.6/site-packages/virtwho/virt/virt.py", line 604, in _send_data
    self.dest.hypervisorHeartbeat(config=self.config, options=self.options)
  File "/usr/lib/python3.6/site-packages/virtwho/manager/subscriptionmanager/subscriptionmanager.py", line 270, in hypervisorHeartbeat
    connection = self._connect(config)
  File "/usr/lib/python3.6/site-packages/virtwho/manager/subscriptionmanager/subscriptionmanager.py", line 167, in _connect
    if not self.connection.ping()['result']:
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 1071, in ping
    return self.conn.request_get("/status/")
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 934, in request_get
    return self._request("GET", method, headers=headers, cert_key_pairs=cert_key_pairs)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 967, in _request
    info=info, headers=headers, cert_key_pairs=cert_key_pairs)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 788, in _request
    err))
rhsm.connection.ProxyException: Unable to connect to: 10.73.3.24:9999 [Errno 111] Connection refused 
2022-06-16 06:47:12,972 [virtwho.destination_-515115144285168198 INFO] MainProcess(137570):Thread-3 @virt.py:_send_data:615 - Error report received
2022-06-16 06:47:12,972 [virtwho.destination_-515115144285168198 INFO] MainProcess(137570):Thread-3 @virt.py:run:440 - Waiting 3600 seconds before performing action again 'destination_-515115144285168198'
2022-06-16 06:47:39,992 [virtwho.main DEBUG] MainProcess(137570):MainThread @executor.py:terminate:225 - virt-who is shutting down
--------------------------



Expected results:
virt-who runs normally


Additional info:
this case only failed for rhevm hypervisor.
similar bug:https://bugzilla.redhat.com/show_bug.cgi?id=1739358

Comment 3 RHEL Program Management 2023-10-10 10:20:07 UTC
Issue migration from Bugzilla to Jira is in process at this time. This will be the last message in Jira copied from the Bugzilla bug.

Comment 4 RHEL Program Management 2023-10-10 10:21:53 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.