os-net-config not run when conf is empty and re-introduce exception.

There may be cases where os-net-config is empty leading to issue when
we force the run during its special treatment in upgrade/update.

Piggy back in this review is re-adding the os-net-config special
handling to update and non-controller.  But it’s more robust now it
won’t run the command unconditionally, it needs:
 - os-net-config to be upgraded
 - /etc/os-net-config/config.json to exist and not be empty.

Another improvement is that it will prevent any networking cut during
its run as we are using the –no-activate flag.

Change-Id: Ie1b88d5cac22fca5b0b325b1dd8c81d65b63acb8
Closes-Bug: #1728889
This commit is contained in:
Sofer Athlan-Guyot 2017-10-31 11:18:21 +01:00
parent ecb5483079
commit 1147e6ced8
5 changed files with 22 additions and 16 deletions

View File

@ -8,6 +8,7 @@ set -o pipefail
UPGRADE_SCRIPT=/root/tripleo_upgrade_node.sh
declare -f update_os_net_config > $UPGRADE_SCRIPT
declare -f special_case_ovs_upgrade_if_needed > $UPGRADE_SCRIPT
declare -f update_network >> $UPGRADE_SCRIPT
# use >> here so we don't lose the declaration we added above

View File

@ -19,6 +19,7 @@ set -eu
crudini --set /etc/nova/nova.conf upgrade_levels compute $upgrade_level_nova_compute
# Special-case OVS for https://bugs.launchpad.net/tripleo/+bug/1669714
$(declare -f update_os_net_config)
$(declare -f special_case_ovs_upgrade_if_needed)
$(declare -f update_network)
update_network

View File

@ -111,8 +111,7 @@ if [ $DO_MYSQL_UPGRADE -eq 1 ]; then
mv /var/lib/mysql $MYSQL_TEMP_UPGRADE_BACKUP_DIR
fi
update_os_net_config
# Special-case OVS for https://bugs.launchpad.net/tripleo/+bug/1669714
# Special-case for network.
update_network
if grep -q '^pipeline = ssl_header_handler faultwrap osvolumeversionapp' /etc/cinder/api-paste.ini; then

View File

@ -23,6 +23,7 @@ function systemctl_swift {
done
}
$(declare -f update_os_net_config)
$(declare -f special_case_ovs_upgrade_if_needed)
$(declare -f update_network)
update_network

View File

@ -353,26 +353,30 @@ function update_os_net_config() {
if [ -n "${need_update}" ]; then
yum -q -y update os-net-config
local return_code=$?
log_debug "yum update os-net-config return code: $return_code"
# We're just make sure that os-net-config won't ifdown/ifup
# network interfaces. The current set of changes (Tue Oct 3
# 17:38:37 CEST 2017) doesn't require the os-net-config change
# to be taken live. They will be at next reboot.
os-net-config --no-activate -c /etc/os-net-config/config.json -v \
--detailed-exit-codes
local os_net_retval=$?
if [[ $os_net_retval == 2 ]]; then
log_debug "os-net-config: interface configuration files updated successfully"
elif [[ $os_net_retval != 0 ]]; then
log_debug "ERROR: os-net-config configuration failed"
exit $os_net_retval
echo "`date` yum update os-net-config return code: $return_code"
if [ -s "/etc/os-net-config/config.json" ]; then
# We're just make sure that os-net-config won't ifdown/ifup
# network interfaces. The current set of changes (Tue Oct 3
# 17:38:37 CEST 2017) doesn't require the os-net-config change
# to be taken live. They will be at next reboot.
os-net-config --no-activate -c /etc/os-net-config/config.json -v \
--detailed-exit-codes
local os_net_retval=$?
if [[ $os_net_retval == 2 ]]; then
echo "`date` os-net-config: interface configuration files updated successfully"
elif [[ $os_net_retval != 0 ]]; then
echo "`date` ERROR: os-net-config configuration failed"
exit $os_net_retval
fi
else
echo "`date` /etc/os-net-config/config.json doesn't exist or is empty. No need to run os-net-config."
fi
fi
set -e
}
function update_network() {
update_os_net_config
# special case https://bugs.launchpad.net/tripleo/+bug/1635205 +bug/1669714
special_case_ovs_upgrade_if_needed
}