Ensure openvswitch user exist before package update

Ovs uses openvswitch user when updating package to 2.8
onwards, but openvswitch user is not exist and will not
be created during package update. This is going to add
workaround to make sure openvswitch user exist before
running package update.

Related-Bug: #1759982
Co-Authored-By: Yolanda Robla Mota <yroblamo@redhat.com>
Change-Id: I913e56c676890c4071f60aa190d02bfaca264d76
(cherry picked from commit 1051fbe10b)
This commit is contained in:
Zenghui Shi 2018-03-28 15:04:20 +08:00
parent 1845647c7a
commit 2e96965c43
1 changed files with 13 additions and 0 deletions

View File

@ -325,6 +325,19 @@ function systemctl_swift {
function special_case_ovs_upgrade_if_needed {
# Always ensure yum has full cache
yum makecache || echo "Yum makecache failed. This can cause failure later on."
# Ovs uses openvswitch:hugetlbfs as user and group settings
# when updating to 2.8 onwards, but openvswitch user is not
# created during package update. This adds workaround to
# make sure openvswitch user exist before running package
# update. Details can be found at:
# https://bugzilla.redhat.com/show_bug.cgi?id=1559374
# 42477 is the kolla hugetlbfs gid value.
getent group hugetlbfs >/dev/null || \
groupadd hugetlbfs -g 42477 && groupmod -g 42477 hugetlbfs
getent passwd openvswitch >/dev/null || \
useradd -r -d / -s /sbin/nologin -c "Open vSwitch Daemons" openvswitch
usermod -a -G hugetlbfs openvswitch
if rpm -qa | grep "^openvswitch-2.5.0-14" || rpm -q --scripts openvswitch | awk '/postuninstall/,/*/' | grep "systemctl.*try-restart" ; then
echo "Manual upgrade of openvswitch - ovs-2.5.0-14 or restart in postun detected"
rm -rf OVS_UPGRADE