Changing LANG from en_US to en_US.UTF-8 fixed both openstack and nova clients. Thanks for the advice!

 

 

From: Radosław Piliszek <radoslaw.piliszek@gmail.com>
Sent: Friday, January 31, 2020 1:41 PM
To: Albert Braden <albertb@synopsys.com>
Cc: Radosław Piliszek <radoslaw.piliszek@gmail.com>; OpenStack Discuss ML <openstack-discuss@lists.openstack.org>
Subject: Re: "encoding error when doing console log show" in Rocky

 

No idea...

 

Last thing to try: play with locale settings (locale command).

Try setting LANG to en_US.UTF-8 (or en_US if that fails).

 

-yoctozepto

 

On Fri, Jan 31, 2020, 22:36 Albert Braden <Albert.Braden@synopsys.com> wrote:

They both upgraded but still fail:

 

root@us01odc-dev2-ctrl1:~# nova --version

16.0.0

root@us01odc-dev2-ctrl1:~# nova console-log 3febd3b2-df87-4f06-884b-378116c6fe4c

ERROR (UnicodeEncodeError): 'latin-1' codec can't encode characters in position 46615-46617: ordinal not in range(256)

root@us01odc-dev2-ctrl1:~# os --version

openstack 4.0.0

root@us01odc-dev2-ctrl1:~# os console log show 3febd3b2-df87-4f06-884b-378116c6fe4c

'latin-1' codec can't encode characters in position 46615-46617: ordinal not in range(256)

 

If I look at /usr/lib/python2.7/dist-packages/openstackclient/compute/v2/console.py on the controller, I see the new code from https://review.opendev.org/#/c/541609/3/openstackclient/compute/v2/console.py:

 

   if data and data[-1] != '\n':

            data += '\n'

        self.app.stdout.write(data)

 

Also I see this in the review at https://review.opendev.org/#/c/541609

 

If you are sure this works, please ignore my comment.

I tried to verify this on a local python console (python-2.7.13).

To do this I used

sys.stdout = codecs.getwriter('ascii')(sys.stdout)

and

sys.stdout = codecs.getwriter('utf-8')(sys.stdout)

Before running the first command, I can write any unicode-character, after the first command I get the same error as in the bug report. After running the second command, the error persists.

That makes me believe, your patch won't fix the issue completely.

 

Is my cluster one of the cases where the patch doesn’t fix the issue?

 

From: Radosław Piliszek <radoslaw.piliszek@gmail.com>
Sent: Friday, January 31, 2020 1:21 PM
To: Albert Braden <albertb@synopsys.com>
Cc: Radosław Piliszek <radoslaw.piliszek@gmail.com>; OpenStack Discuss ML <openstack-discuss@lists.openstack.org>
Subject: Re: "encoding error when doing console log show" in Rocky

 

Ok, try upgrading both to the latest (no pin). Latest clients should still work on Rocky and we don't have to guess versions.

 

-yoctozepto

 

On Fri, Jan 31, 2020, 22:12 Albert Braden <Albert.Braden@synopsys.com> wrote:

In my other cluster where I haven't upgraded anything since the Rocky install, the old nova version 11 client works, but the openstack client fails:

root@us01odc-dev1-ctrl1:~# openstack --version
openstack 3.16.1
root@us01odc-dev1-ctrl1:~# openstack console log show 5a923a92-8fd1-48fd-8b76-768d1fb5f0c6
'latin-1' codec can't encode characters in position 45794-45796: ordinal not in range(256)
root@us01odc-dev1-ctrl1:~# nova --version
11.0.0
root@us01odc-dev1-ctrl1:~# nova console-log 5a923a92-8fd1-48fd-8b76-768d1fb5f0c6
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 3.10.0-957.5.1.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150
...