Virt-who configurations for Hyper-V failing with UnicodeDecodeError on Red Hat Satellite 6

Solution Verified - Updated

Environment

  • Red Hat Satellite 6.5.x
  • Virt-who 0.24.7-1
  • Microsoft Hyper-V

Issue

  • Hyper-V virt-who configurations fail with the following error:

    UnicodeDecodeError: 'ascii' codec can't decode byte 0xb2 in position 13: ordinal not in range(128)
    

Resolution

  • This is a known issue with virt-who 0.24.7-1 on Microsoft HyperV and was being tracked by Bugzilla This content is not included.1745768 . The Bugzilla has been closed with the release of an errata.

  • Apply the errata RHBA-2020:0990 for resolution.

  • Also, as a workaround, change the syntax of username from username\domain to username@domain or username in the virt-who configuration at /etc/virt-who/virt-who-config-X.conf

    [virt-who-config-X]
    type=hyperv
    hypervisor_id=hostname
    owner=Organization
    env=Library
    server=vcenter.example.com                                  
    username=username\domain                                      <----------------- username@domain or username
    encrypted_password=<VCenterPassword>
    rhsm_hostname=satellite.example.com
    rhsm_username=<VirtWhoReporter>
    rhsm_encrypted_password=<SatelliteVirtWhoReporterPassword>
    rhsm_prefix=/rhsm
    

For more KB articles/solutions related to Virt-who and Virtual Datacenter (VDC) Subscriptions Issues, please refer to the Consolidated Troubleshooting Article for Virt-who and Virtual Datacenter (VDC) Subscriptions Issues

Diagnostic Steps

  • Execute the following command with Hyper-V virt-who configuration:

    #  virt-who -od -c virt-who-config-X.conf &> virt.log
    
  • Check the generated log for the following error:

    2019-08-26 17:00:49,297 [virtwho.main ERROR] MainProcess(31538):Thread-2 @virt.py:run:421 - Thread 'virt-who-config-X' fails with exception:
    Traceback (most recent call last):
      File "/usr/lib/python2.7/site-packages/virtwho/virt/virt.py", line 412, in run
        self._run()
      File "/usr/lib/python2.7/site-packages/virtwho/virt/virt.py", line 367, in _run
        data_to_send = self._get_data()
      File "/usr/lib/python2.7/site-packages/virtwho/virt/virt.py", line 963, in _get_data
        return self._get_report()
      File "/usr/lib/python2.7/site-packages/virtwho/virt/virt.py", line 951, in _get_report
        return HostGuestAssociationReport(self.config, self.getHostGuestMapping())
      File "/usr/lib/python2.7/site-packages/virtwho/virt/hyperv/hyperv.py", line 564, in getHostGuestMapping
        "root/virtualization")
      File "/usr/lib/python2.7/site-packages/virtwho/virt/hyperv/hyperv.py", line 420, in Enumerate
        body = self.post(data)
      File "/usr/lib/python2.7/site-packages/virtwho/virt/hyperv/hyperv.py", line 382, in post
        response = self.connection.post(self.url, body, headers=headers)
      File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 520, in post
        return self.request('POST', url, data=data, json=json, **kwargs)
      File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 477, in request
        resp = self.send(prep, **send_kwargs)
      File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 595, in send
        r = dispatch_hook('response', hooks, r, **kwargs)
      File "/usr/lib/python2.7/site-packages/requests/hooks.py", line 41, in dispatch_hook
        _hook_data = hook(hook_data, **kwargs)
      File "/usr/lib/python2.7/site-packages/virtwho/virt/hyperv/hyperv.py", line 240, in handle_response
        return self.retry_ntlm_negotiate(response, **kwargs)
      File "/usr/lib/python2.7/site-packages/virtwho/virt/hyperv/hyperv.py", line 126, in retry_ntlm_negotiate
        negotiate = base64.b64encode(self.ntlm.negotiate_message(self.username)).decode('utf-8')
      File "/usr/lib/python2.7/site-packages/virtwho/virt/hyperv/ntlm.py", line 495, in negotiate_message
        data = NegotiateMessage(self.domain, self.workstation).data
      File "/usr/lib/python2.7/site-packages/virtwho/virt/hyperv/ntlm.py", line 202, in data
        return self._format()
      File "/usr/lib/python2.7/site-packages/virtwho/virt/hyperv/ntlm.py", line 263, in _format
        return OutgoingMessage._format(self) + self.domain + self.workstation
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xb2 in position 13: ordinal not in range(128)
    
SBR
Product(s)
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.