Bug 1415079 - Start virt-who will show "ValueError: invalid literal for int() with base 10" when rhsm_port is null
Summary: Start virt-who will show "ValueError: invalid literal for int() with base 10"...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: virt-who
Version: 7.0
Hardware: x86_64
OS: Linux
medium
low
Target Milestone: pre-dev-freeze
: ---
Assignee: Jiri Hnidek
QA Contact: Eko
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-01-20 07:55 UTC by Liushihui
Modified: 2019-10-28 07:22 UTC (History)
10 users (show)

Fixed In Version: virt-who-0.19-3
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-10 16:19:53 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github virt-who virt-who pull 59 0 None None None 2017-06-09 07:30:26 UTC
Red Hat Product Errata RHEA-2018:0895 0 None None None 2018-04-10 16:21:04 UTC

Description Liushihui 2017-01-20 07:55:56 UTC
Description of problem:
If rhsm_port is null in /etc/virt-who.d/xxxx, restart virt-who will show error info "ValueError: invalid literal for int() with base 10: ''"

Version-Release number of selected component (if applicable):
virt-who-0.17-10.el7sat.noarch
subscription-manager-1.17.15-1.el7.x86_64
python-rhsm-1.17.9-1.el7.x86_64
Satellite6.2.7-sp2.0

How reproducible:
Always

Steps to Reproduce:
1. Configure virt-who with rhsm_port is null ,see config as the following:
[root@hp-z220-08 virt-who.d]# cat /etc/virt-who.d/virt 
[test-xen]
type=xen
server=10.73.5.237
username=root
password=red2017
owner=org1
env=Library
rhsm_username=admin
rhsm_password=admin
hypervisor_id=hostname
rhsm_port=                       ====>It's null

2. Restart virt-who service and check virt-who's log.
[root@hp-z220-08 virt-who.d]# service virt-who restart&& tail -f /var/log/rhsm/rhsm.log 
2017-01-20 02:48:58,634 [virtwho.main DEBUG] MainProcess(28577):MainThread @executor.py:terminate:303 - virt-who is shutting down
2017-01-20 02:49:03,789 [virtwho.init DEBUG] MainProcess(28710):MainThread @executor.py:__init__:65 - Using config named 'test-xen'
2017-01-20 02:49:03,789 [virtwho.init INFO] MainProcess(28710):MainThread @main.py:main:160 - Using configuration "test-xen" ("xen" mode)
2017-01-20 02:49:03,789 [virtwho.init INFO] MainProcess(28710):MainThread @main.py:main:162 - Using reporter_id='hp-z220-08.qe.lab.eng.nay.redhat.com-30d29fdbb2724d2f81193360a1678d5b'
2017-01-20 02:49:03,791 [virtwho.main DEBUG] MainProcess(28710):MainThread @executor.py:run:171 - Starting infinite loop with 60 seconds interval
2017-01-20 02:49:03,820 [virtwho.test-xen DEBUG] Xen-1(28718):MainThread @virt.py:run:364 - Virt backend 'test-xen' started
2017-01-20 02:49:03,820 [virtwho.test-xen DEBUG] Xen-1(28718):MainThread @xen.py:_prepare:42 - Logging into XEN pools https://10.73.5.237
2017-01-20 02:49:03,899 [virtwho.test-xen DEBUG] Xen-1(28718):MainThread @xen.py:login:52 - XEN pool login successful with user root
2017-01-20 02:49:04,364 [virtwho.test-xen DEBUG] Xen-1(28718):MainThread @xen.py:getHostGuestMapping:80 - Control Domain 7a20400e-06ed-4b90-93e8-5f8a2f415ac9 is ignored
2017-01-20 02:49:04,425 [virtwho.test-xen DEBUG] Xen-1(28718):MainThread @xen.py:getHostGuestMapping:80 - Control Domain b8b4312d-d70a-4709-8c7a-5500e746432f is ignored
2017-01-20 02:49:04,425 [virtwho.test-xen DEBUG] Xen-1(28718):MainThread @virt.py:enqueue:357 - Report for config "test-xen" gathered, putting to queue for sending
2017-01-20 02:49:04,437 [virtwho.main ERROR] MainProcess(28710):MainThread @executor.py:send:156 - Error in communication with subscription manager:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/virtwho/executor.py", line 139, in send
    self._sendGuestAssociation(report)
  File "/usr/lib/python2.7/site-packages/virtwho/executor.py", line 166, in _sendGuestAssociation
    manager.hypervisorCheckIn(report, self.options)
  File "/usr/lib/python2.7/site-packages/virtwho/manager/subscriptionmanager/subscriptionmanager.py", line 170, in hypervisorCheckIn
    self._connect(report.config)
  File "/usr/lib/python2.7/site-packages/virtwho/manager/subscriptionmanager/subscriptionmanager.py", line 98, in _connect
    kwargs['ssl_port'] = int(config.rhsm_port)
ValueError: invalid literal for int() with base 10: ''
2017-01-20 02:49:04,437 [virtwho.main DEBUG] MainProcess(28710):MainThread @executor.py:send_report:108 - Report from "test-xen" failed to sent


Actual results:
When rhsm_port is null, it will show "ValueError: invalid literal for int() with base 10: ''" when virt-who communicate with subscription-manager

Expected results:
It shouldn't show these error info. it should show brief info to remind failed to connect server.

Additional info:

Comment 4 Jiri Hnidek 2017-06-09 07:30:26 UTC
It is probably already fixed by PR:

https://github.com/virt-who/virt-who/pull/59

and this commit:

https://github.com/virt-who/virt-who/commit/e640a5e66cc21c30d5c0aa93b233625cdf7aa2aa

It prints now following error to log:

2017-06-09 09:08:08,463 [virtwho.destination_-6801565354001199939 DEBUG] MainProcess(8551):Thread-3 @subscriptionmanager.py:sendVirtGuests:162 - Using hypervisor_id: fb9d1281-53cc-11cb-9a33-8043c5f45d9d
2017-06-09 09:08:08,466 [rhsm.connection DEBUG] MainProcess(8551):Thread-3 @connection.py:_request:516 - Making request: GET /subscription/
2017-06-09 09:08:12,333 [rhsm.connection INFO] MainProcess(8551):Thread-3 @connection.py:_request:557 - Response: status=200, request="GET /subscription/"
2017-06-09 09:08:12,334 [rhsm.connection DEBUG] MainProcess(8551):Thread-3 @connection.py:_load_supported_resources:844 - Server supports the following resources: {u'': u'/', u'guestids': u'/consumers/{consumer_uuid}/guestids', u'cdn': u'/cdn', u'content_overrides': u'/consumers/{consumer_uuid}/content_overrides', u'hypervisors': u'/hypervisors', u'serials': u'/serials', u'deleted_consumers': u'/deleted_consumers', u'consumers': u'/consumers', u'migrations': u'/migrations', u'content': u'/content', u'entitlements': u'/entitlements', u'events': u'/events', u'status': u'/status', u'jobs': u'/jobs', u'users': u'/users', u'subscriptions': u'/subscriptions', u'rules': u'/rules', u'distributor_versions': u'/distributor_versions', u'consumertypes': u'/consumertypes', u'statistics/generate': u'/statistics/generate', u'pools': u'/pools', u'atom': u'/atom', u'packages': u'/consumers/{consumer_uuid}/packages', u'owners': u'/owners', u'roles': u'/roles', u'admin': u'/admin', u'products': u'/products', u'activation_keys': u'/activation_keys', u'crl': u'/crl'}
2017-06-09 09:08:12,334 [rhsm.connection DEBUG] MainProcess(8551):Thread-3 @connection.py:_request:516 - Making request: PUT /subscription/consumers/37e48228-5398-45bd-90a6-6eb1dcd98a94
2017-06-09 09:08:16,837 [rhsm.connection INFO] MainProcess(8551):Thread-3 @connection.py:_request:557 - Response: status=401, request="PUT /subscription/consumers/37e48228-5398-45bd-90a6-6eb1dcd98a94"
2017-06-09 09:08:16,838 [virtwho.destination_-6801565354001199939 ERROR] MainProcess(8551):Thread-3 @virt.py:run:389 - Thread 'destination_-6801565354001199939' fails with exception:
Traceback (most recent call last):
  File "virtwho/virt/virt.py", line 380, in run
    self._run()
  File "virtwho/virt/virt.py", line 336, in _run
    self._send_data(data_to_send)
  File "virtwho/virt/virt.py", line 684, in _send_data
    self.dest.sendVirtGuests(report, options=self.options)
  File "virtwho/manager/subscriptionmanager/subscriptionmanager.py", line 166, in sendVirtGuests
    self.connection.updateConsumer(self.uuid(), guest_uuids=serialized_guests, hypervisor_id=report.hypervisor_id)
  File "/home/jiri/github/candlepin/subscription_manager/python-rhsm/src/rhsm/connection.py", line 1007, in updateConsumer
    ret = self.conn.request_put(method, params)
  File "/home/jiri/github/candlepin/subscription_manager/python-rhsm/src/rhsm/connection.py", line 660, in request_put
    return self._request("PUT", method, params, headers=headers)
  File "/home/jiri/github/candlepin/subscription_manager/python-rhsm/src/rhsm/connection.py", line 677, in _request
    info=info, headers=headers)
  File "/home/jiri/github/candlepin/subscription_manager/python-rhsm/src/rhsm/connection.py", line 566, in _request
    self.validateResponse(result, request_type, handler)
  File "/home/jiri/github/candlepin/subscription_manager/python-rhsm/src/rhsm/connection.py", line 615, in validateResponse
    raise RestlibException(response['status'], error_msg, response.get('headers'))
RestlibException: Invalid credentials.
2017-06-09 09:08:16,840 [virtwho.destination_-6801565354001199939 INFO] MainProcess(8551):Thread-3 @virt.py:_send_data:563 - Error report received
2017-06-09 09:08:16,840 [virtwho.destination_-6801565354001199939 DEBUG] MainProcess(8551):Thread-3 @virt.py:run:403 - Thread 'destination_-6801565354001199939' stopped after running once
2017-06-09 09:08:17,759 [virtwho.main DEBUG] MainProcess(8551):MainThread @__main__.py:main:23 - virt-who terminated
2017-06-09 09:08:17,759 [virtwho.main DEBUG] MainProcess(8551):MainThread @executor.py:terminate:226 - virt-who is shutting down

May be, rhsm could raise better exception, when connection to candlepin server wasn't possible

Comment 5 Chris Snyder 2017-06-09 13:44:10 UTC
Adding dev_ack+ as the attached PR is merged to master. This fix should be included in the first build for RHEL 7.5.

Comment 12 errata-xmlrpc 2018-04-10 16:19:53 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, 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/RHEA-2018:0895


Note You need to log in before you can comment on or make changes to this bug.