Bug 1752522 - ovirt-fast-forward-upgrade: Upgrade from 4.2 to 4.3 fails with UnicodeEncodeError
Summary: ovirt-fast-forward-upgrade: Upgrade from 4.2 to 4.3 fails with UnicodeEncodeE...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-fast-forward-upgrade
Version: 4.2.0
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: ovirt-4.3.9
: ---
Assignee: Douglas Schilling Landgraf
QA Contact: Petr Matyáš
URL:
Whiteboard:
Depends On: 1766445
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-09-16 14:29 UTC by Juan Orti
Modified: 2023-03-24 15:27 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Previously, when upgrading RHV version 4.2 to 4.3 using Satellite, the upgrade failed with a UnicodeEncodeError. The current release fixes this issue.
Clone Of:
Environment:
Last Closed: 2020-04-02 16:32:17 UTC
oVirt Team: Integration
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHV-47499 0 None None None 2022-07-09 15:23:53 UTC
Red Hat Knowledge Base (Solution) 4417681 0 None None None 2019-09-16 14:37:23 UTC
Red Hat Product Errata RHSA-2020:1308 0 None None None 2020-04-02 16:32:58 UTC
oVirt gerrit 106485 0 master MERGED ovirt-fast-forward-upgrade: Set empty environment to execute commands 2020-05-15 12:21:00 UTC
oVirt gerrit 106487 0 ovirt-4.3 MERGED ovirt-fast-forward-upgrade: Set empty environment to execute commands 2020-05-15 12:21:00 UTC
oVirt gerrit 107446 0 master MERGED ovirt-ff: Only use env -i for subscription-manager 2020-05-15 12:21:01 UTC
oVirt gerrit 107448 0 ovirt-4.3 MERGED ovirt-ff: Only use env -i for subscription-manager 2020-05-15 12:21:01 UTC

Description Juan Orti 2019-09-16 14:29:25 UTC
Description of problem:

The upgrade of RHV 4.2 to 4.3 fails with this error [2]. Satellite is being used and no Unicode character has been found in yum repos files.

Enabling the repositories manually with subscription-manager and updating as explained in the docs [1], works fine.

[1] https://access.redhat.com/documentation/en-us/red_hat_virtualization/4.3/html/upgrade_guide/upgrading_from_4-2

[2]
~~~
[ INFO  ] Executing: env LC_ALL=C subscription-manager repos --enable rhel-7-server-rhv-4.3-manager-rpms --enable jb-eap-7.2-for-rhel-7-server-rpms
Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 9, in <module>
    load_entry_point('subscription-manager==1.24.13', 'console_scripts', 'subscription-manager')()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/scripts/subscription_manager.py", line 85, in main
    return managercli.ManagerCLI().main()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 2922, in main
    ret = CLI.main(self)
  File "/usr/lib64/python2.7/site-packages/subscription_manager/cli.py", line 183, in main
    return cmd.main()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 506, in main
    return_code = self._do_command()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 2260, in _do_command
    rc = self._set_repo_status(repos, rl, self.options.repo_actions)
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 2358, in _set_repo_status
    print(_("Repository '%s' is enabled for this system.") % repo.id)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 4: ordinal not in range(128)
[ ERROR  ] Cannot enable repository: jb-eap-7.2-for-rhel-7-server-rpms
~~~

Version-Release number of selected component (if applicable):
ovirt-fast-forward-upgrade-1.0.0-12.el7ev.noarch
ovirt-engine-4.2.8.7-0.1.el7ev.noarch

How reproducible:
Always in this setup

Steps to Reproduce:
1. ovirt-fast-forward-upgrade --backup --backup-dir=/var/lib/ovirt-engine/backups/   


Actual results:
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 4: ordinal not in range(128)

Expected results:
Upgrade successful.

Additional info:

/etc/locale.conf:

~~~
LANG="en_US.UTF-8"
~~~

sos_commands/i18n/locale:

~~~
LANG=fr_FR.UTF-8
LC_CTYPE="fr_FR.UTF-8"
LC_NUMERIC="fr_FR.UTF-8"
LC_TIME="fr_FR.UTF-8"
LC_COLLATE="fr_FR.UTF-8"
LC_MONETARY="fr_FR.UTF-8"
LC_MESSAGES="fr_FR.UTF-8"
LC_PAPER="fr_FR.UTF-8"
LC_NAME="fr_FR.UTF-8"
LC_ADDRESS="fr_FR.UTF-8"
LC_TELEPHONE="fr_FR.UTF-8"
LC_MEASUREMENT="fr_FR.UTF-8"
LC_IDENTIFICATION="fr_FR.UTF-8"
LC_ALL=
~~~

Comment 2 Juan Orti 2019-09-26 08:00:45 UTC
I reproduced it by just having LANG=es_ES.UTF-8 in the environment. Changing it to LANG=en_US.UTF-8 fixes the problem.


~~~
[root@rhvm42 ~]# ovirt-fast-forward-upgrade 
[ INFO  ] Welcome to upgrade helper!

A few reminders before we start:

- Make sure Engine backup is updated!

- This is an incremental upgrade tool. RHV doesn't support
  direct upgrades, example: from 4.0 directly to 4.2

- Red Hat Virtualization clusters have a compatibility version.
  The cluster compatibility version indicates the features of 
  Red Hat Virtualization supported by all of the hosts in the
  cluster.

- The cluster compatibility is set according to the version of
  the least capable host operating system in the cluster.

- To change the cluster compatibility version, you must have first
  updated all the hosts in your cluster to a level that supports
  your desired compatibility level. Check if there is an icon 
  next to the host indicating an update is available.

+----------------------------------------------+
| Red Hat Virtualization Manager Compatibility |
+----------------------------------------------+
| RHV Release | Cluster Compability Levels     |
|----------------------------------------------|
|   4.0       |  4.0, 3.6                      |
|   4.1       |  4.1, 4.0, 3.6                 |
|   4.2       |  4.2, 4.1, 4.0, 3.6            |
|   4.3       |  4.3, 4.2, 4.1                 |
+----------------------------------------------+


Detected RHV version 4.2, target upgrade: 4.3
Do you want to proceed? [N/y]y
[ INFO  ] Collecting enabled repositories by subscription-manager...
[ INFO  ] Executing: env LC_ALL=C subscription-manager repos --list-enabled
[ WARNING  ] The following repositories are required for 4.2
 - rhel-7-server-rhv-4.2-manager-rpms
 - rhel-7-server-ansible-2-rpms
 - rhel-7-server-rhv-4-manager-tools-rpms
 - rhel-7-server-rpms
 - rhel-7-server-supplementary-rpms
 - jb-eap-7-for-rhel-7-server-rpms
Are you sure you want to continue? It might generate conflicts on RPM dependency. [N/y]y
[ INFO  ] Executing: env LC_ALL=C engine-upgrade-check
VERB: queue package ovirt-engine-setup for update
VERB: Downloading: jb-eap-7-for-rhel-7-server-rpms/7Server/x86_64 (0%)
VERB: Downloading: jb-eap-7-for-rhel-7-server-rpms/7Server/x86_64 4.0 k(100%)
VERB: Downloading: rhel-7-server-ansible-2-rpms/x86_64 (0%)
VERB: Downloading: rhel-7-server-ansible-2-rpms/x86_64 4.0 k(100%)
VERB: Downloading: rhel-7-server-rhv-4-manager-tools-rpms/x86_64 (0%)
VERB: Downloading: rhel-7-server-rhv-4-manager-tools-rpms/x86_64 4.0 k(100%)
VERB: Downloading: rhel-7-server-rhv-4.2-manager-rpms/x86_64 (0%)
VERB: Downloading: rhel-7-server-rhv-4.2-manager-rpms/x86_64 4.0 k(100%)
VERB: Downloading: rhel-7-server-rpms/7Server/x86_64 (0%)
VERB: Downloading: rhel-7-server-rpms/7Server/x86_64 3.5 k(100%)
VERB: Downloading: rhel-7-server-supplementary-rpms/7Server/x86_64 (0%)
VERB: Downloading: rhel-7-server-supplementary-rpms/7Server/x86_64 3.4 k(100%)
VERB: Building transaction
VERB: Empty transaction
VERB: Transaction Summary:
No upgrade is available for the setup package.
Please note that system may not be up to date if engine-setup wasn't executed after yum update.
[ INFO  ] Executing: env LC_ALL=C yum update
Loaded plugins: product-id, search-disabled-repos, subscription-manager, versionlock
Excluding 11 updates due to versionlock (use "yum versionlock status" to show them)
No packages marked for update
[ INFO  ] Enabling repository: rhel-7-server-rhv-4.3-manager-rpms
[ INFO  ] Enabling repository: jb-eap-7.2-for-rhel-7-server-rpms
[ INFO  ] Executing: env LC_ALL=C subscription-manager repos --enable rhel-7-server-rhv-4.3-manager-rpms --enable jb-eap-7.2-for-rhel-7-server-rpms
Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 9, in <module>
    load_entry_point('subscription-manager==1.24.13', 'console_scripts', 'subscription-manager')()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/scripts/subscription_manager.py", line 85, in main
    return managercli.ManagerCLI().main()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 2922, in main
    ret = CLI.main(self)
  File "/usr/lib64/python2.7/site-packages/subscription_manager/cli.py", line 183, in main
    return cmd.main()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 506, in main
    return_code = self._do_command()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 2260, in _do_command
    rc = self._set_repo_status(repos, rl, self.options.repo_actions)
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 2358, in _set_repo_status
    print(_("Repository '%s' is enabled for this system.") % repo.id)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 55: ordinal not in range(128)
[ ERROR  ] Cannot enable repository: jb-eap-7.2-for-rhel-7-server-rpms
~~~

Comment 3 Douglas Schilling Landgraf 2019-10-29 05:00:05 UTC
Just verified, it is a issue in subscription-manager affecting ovirt-fast-forward-upgrade.
https://bugzilla.redhat.com/show_bug.cgi?id=1766445
Proposal patch: https://github.com/candlepin/subscription-manager/pull/2179

Workaround: 

Use en_US.UTF-8 in locale.conf:

1. # cat /etc/locale.conf
   LANG="en_US.UTF-8"

2. Reboot

3. trigger again ovirt-fast-forward-upgrade

Comment 4 Sandro Bonazzola 2019-11-07 08:53:57 UTC
Douglas can we set env to LC_ALL=C before calling subscription manager within ovirt-fast-forward-upgrade?
This will solve for us till platform properly fix it.

Comment 5 Douglas Schilling Landgraf 2019-11-07 16:18:28 UTC
(In reply to Sandro Bonazzola from comment #4)
> Douglas can we set env to LC_ALL=C before calling subscription manager
> within ovirt-fast-forward-upgrade?
> This will solve for us till platform properly fix it.

Already there:
https://github.com/oVirt/ovirt-fast-forward-upgrade/blob/master/src/ovirt-fast-forward-upgrade#L254-L260
https://github.com/oVirt/ovirt-fast-forward-upgrade/blob/master/src/ovirt-fast-forward-upgrade#L339-L345


In the description of this bug, you will see also from the logs:
[ INFO  ] Executing: env LC_ALL=C subscription-manager repos --enable rhel-7-server-rhv-4.3-manager-rpms --enable jb-eap-7.2-for-rhel-7-server-rpms

Comment 8 Petr Matyáš 2020-03-03 15:05:03 UTC
Using ovirt-fast-forward-upgrade-1.0.0-17.el7ev.noarch the specific part works,
however the patch causes failure later on when engine-setup is executed with 'env -i LC_ALL=C' which causes it to fail with:

[ INFO  ] Stage: Environment setup (late)
[ ERROR ] Failed to execute stage 'Environment setup (late)': Command 'exportfs' is required but missing

[root@engine ~]# rpm -qa | grep nfs-utils
nfs-utils-1.3.0-0.65.el7.x86_64

[root@engine ~]# exportfs -h
usage: exportfs [-adfhioruvs] [host:/path]

[root@engine ~]# locale
LANG=fr_FR.UTF-8
LC_CTYPE="fr_FR.UTF-8"
LC_NUMERIC="fr_FR.UTF-8"
LC_TIME="fr_FR.UTF-8"
LC_COLLATE="fr_FR.UTF-8"
LC_MONETARY="fr_FR.UTF-8"
LC_MESSAGES="fr_FR.UTF-8"
LC_PAPER="fr_FR.UTF-8"
LC_NAME="fr_FR.UTF-8"
LC_ADDRESS="fr_FR.UTF-8"
LC_TELEPHONE="fr_FR.UTF-8"
LC_MEASUREMENT="fr_FR.UTF-8"
LC_IDENTIFICATION="fr_FR.UTF-8"
LC_ALL=

When engine-setup is executed without 'env -i LC_ALL=C' (or just without the '-i') the setup continues through the check without problems.

Comment 9 Petr Matyáš 2020-03-03 15:07:08 UTC
Error in log:
2020-03-03 15:56:26,742+0100 DEBUG otopi.context context._executeMethod:145 method exception
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/otopi/context.py", line 132, in _executeMethod
    method['method']()
  File "/usr/share/ovirt-engine/setup/bin/../plugins/ovirt-engine-setup/ovirt-engine/system/nfs.py", line 146, in _late_setup
    self.command.get('exportfs'),
  File "/usr/share/otopi/plugins/otopi/system/command.py", line 57, in get
    res = super(Plugin, self).get(command, optional)
  File "/usr/lib/python2.7/site-packages/otopi/command.py", line 74, in get
    command=command
RuntimeError: Command 'exportfs' is required but missing
2020-03-03 15:56:26,743+0100 ERROR otopi.context context._executeMethod:154 Failed to execute stage 'Environment setup (late)': Comman
d 'exportfs' is required but missing

Comment 10 Yedidyah Bar David 2020-03-05 07:57:37 UTC
(In reply to Petr Matyáš from comment #9)
> 2020-03-03 15:56:26,743+0100 ERROR otopi.context context._executeMethod:154
> Failed to execute stage 'Environment setup (late)': Comman
> d 'exportfs' is required but missing

Does this happen also when you run engine-setup directly (with fr_FR.UTF-8)? If so, that's a bug in engine-setup, not in fast-forward.

Please attach the full setup log, thanks.

Comment 11 Petr Matyáš 2020-03-05 08:40:34 UTC
Well, yeah. I thought as it is directly caused by the patch posted here then it can be fixed (actually workarounded) here.

Comment 12 Yedidyah Bar David 2020-03-05 08:50:08 UTC
Did you reproduce and open a bug on engine-setup?

Comment 13 Petr Matyáš 2020-03-05 08:55:08 UTC
Yes, I did.

Comment 14 Lev Veyde 2020-03-05 14:12:23 UTC
(In reply to Yedidyah Bar David from comment #10)
> (In reply to Petr Matyáš from comment #9)
> > 2020-03-03 15:56:26,743+0100 ERROR otopi.context context._executeMethod:154
> > Failed to execute stage 'Environment setup (late)': Comman
> > d 'exportfs' is required but missing
> 
> Does this happen also when you run engine-setup directly (with fr_FR.UTF-8)?
> If so, that's a bug in engine-setup, not in fast-forward.
> 
> Please attach the full setup log, thanks.

It seems to be directly related to 'env -i'.

Comment 17 errata-xmlrpc 2020-04-02 16:32:17 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/RHSA-2020:1308


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