Bug 2021525 - [16.1] openstack overcloud upgrade run times out / HAProxy container fails to start
Summary: [16.1] openstack overcloud upgrade run times out / HAProxy container fails to...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-tripleo-heat-templates
Version: 16.1 (Train)
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: z8
: 16.1 (Train on RHEL 8.2)
Assignee: Lukas Bezdicka
QA Contact: Jason Grosso
URL:
Whiteboard:
Depends On:
Blocks: 2021575
TreeView+ depends on / blocked
 
Reported: 2021-11-09 14:29 UTC by gdamien
Modified: 2022-03-24 11:02 UTC (History)
9 users (show)

Fixed In Version: openstack-tripleo-heat-templates-11.3.2-1.20220114223344.el8ost
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2021575 (view as bug list)
Environment:
Last Closed: 2022-03-24 11:02:17 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
OpenStack gerrit 817079 0 None MERGED [TRAIN-ONLY] Add a new upgrade task for some services 2022-02-17 15:08:57 UTC
OpenStack gerrit 828792 0 None MERGED [train-only][ffwd] Fix pacemaker container selinux context 2022-02-23 12:59:01 UTC
Red Hat Issue Tracker OSP-10704 0 None None None 2021-11-15 16:47:19 UTC
Red Hat Issue Tracker UPG-4759 0 None None None 2021-11-09 14:52:12 UTC
Red Hat Knowledge Base (Solution) 6497141 0 None None None 2021-11-10 08:27:20 UTC
Red Hat Product Errata RHBA-2022:0986 0 None None None 2022-03-24 11:02:38 UTC

Internal Links: 2021894

Description gdamien 2021-11-09 14:29:25 UTC
Description of problem:
While proceeding with FFU steps, this command is timing out on the bootstrap controller

Haproxy container was not able to start
 /var/lib/haproxy/stats is having wrong SELinux contexts 

Version-Release number of selected component (if applicable):
From Image: 	RHEL-7.7 + OSP-13.0.10 and contrail-image: - 1912.L1-46 
To image: 	RHEL-8.2 + OSP16.1.6 and contrail-image: - 2011.L2.372 


How reproducible:
openstack overcloud upgrade run --yes   --stack overcloud --limit $host --playbook all


Steps to Reproduce:
1.hosts=vmwebrhoctrl1,vmwebjuctrl1,vmwebjudatabase1,vmwebjuengine1
2.openstack overcloud upgrade run --yes   --stack overcloud --limit $host --playbook all
3.

Actual results:
# ls -lZ /var/lib/haproxy/stats 
srw-------. 1 root root system_u:object_r:haproxy_var_lib_t:s0 0  8 nov.  10:05 /var/lib/haproxy/stats

Expected results:
It should be system_u:object_r:container_file_t:s0


Additional info:

Comment 1 Cédric Jeanneret 2021-11-09 15:41:12 UTC
Some thoughts, ideas, solutions and others:

- a patch is available as train-only here: https://review.opendev.org/c/openstack/tripleo-heat-templates/+/817079
- it's a "follow-up" of the other one I already provided earlier, related to the OVN service: https://review.opendev.org/c/openstack/tripleo-heat-templates/+/808964

As previously said, we can't just backport [1] down to train/osp-16.x because it would create a complete service outage on day-2 operations such as scale-out - this would be a bad experience for the operator, and we can't allow that. 

Now, why do we see this situation:
while FFU-ing, we get the mighty cleanup of the OSP related packages and services (with containers), the LEAPP to upgrade the OS, the addition of /.autorelabel, and the reboot; then, we get the installation of the new OSP packages, the "upgrades" steps as described in tripleo-heat-templates, and a deploy, in order to start the services and get things back up.
The issue happens with the /.autorelabel, and the following restorecon happening system-wide: since openstack-selinux is removed at this point, and since new system SELinux packages are installed, the restorecon will override anything we set with ":z" flag. More over, since we cannot override system/core fcontext from within openstack-selinux, we may end with non-applicable rules (such as /var/log/containers for osp-16.2 conflicting with a newer version of container-selinux).

So we may end with wrongly labelled directories and, more importantly, directory content.
Now, by default, we don't do anything related to selinux labels/context in the upgrade - so let's move to the deploy itself. Here, nested in tripleo-heat-templates and tripleo-ansible, we do manage some specific "setype" associated to some directory creations. But we're not doing this recursively - it's usually useless, and time consuming (ansible.builtin.file is slow in recursion, really). So we just ensure the directories are present, with the wanted context. And we usually count on the ":z" option set to most of the container volumes in order to get the proper context for anything.... But that flag is missing from pacemaker managed bundles (at least until wallaby/osp-17).

This may lead to weird situation, where a container isn't started from the deploy actions, but only by pacemaker - so it will end with the directory having the correct context (thanks to the deploy "host_prep_tasks" steps), but not its content - such as this "stat" file in /var/lib/haproxy. And crash.


[1] https://review.opendev.org/c/openstack/puppet-tripleo/+/809132

Comment 12 Lukas Bezdicka 2022-02-10 20:54:14 UTC
Failing QA on customer environment :(

Comment 13 Lukas Bezdicka 2022-02-10 20:56:17 UTC
Turned out the patch is missing tasks for pacemaker controlled services which is what majority of installations is. I'm working on patch resolving this and will test it directly on customer environment.

For next time verification tasks:
Ensure correct label on mysql data directory and content
Ensure correct label on rabbitmq data directory and content
Ensure correct label on haproxy data directory and content

have to be present in upgrade run logs.

Comment 20 errata-xmlrpc 2022-03-24 11:02: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 (Red Hat OpenStack Platform 16.1.8 bug fix and enhancement 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/RHBA-2022:0986


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