When executing upgrade bootstrap for AIO-SX only update /etc/network/

During upgrade bootstrap, the runtime execution of the puppet class
platform::network::runtime created a lock timeout with sysinv-agent
to allow the interface configuration in the kernel. The lock exists
to allow sysinv-agent to collect interface information for the
system inventory.

The optimized upgrade feature created this runtime execution to fill
the contents in /etc/network/interface.d/ and /etc/network/routes
to be available during the network bringup phase that happens after
the system unlock in an earlier step than the regular puppet manifest
execution. But as part of apply_network_config.sh execution it also
brings up the interfaces, accessing the script protected section and
causing lock timeout.

This change uses the file /var/run/.network_upgrade_bootstrap to
indicate a upgrade bootstrap  is under way to just populate the
/etc/network files and to not activate the interfaces.

The interface activation is not needed as the bootstrap is still under
way and the minimal network configuration is already provided prior to
the bootstrap. After unlocking the files in /etc/network will provide
a faster network availability as systemd's network service is one of
the first to be executed during boot.

Test Plan:
[PASS] in 21.12 add an assorted network configuration with
       - vlan, bonded, and ethernet interfaces (the vlan interface on
         top of both base interfaces)
       - configure the bond interface with static address
       - add routes on all platform and data interfaces
[PASS] execute lock/unlock in 21.12 to verify config in applied
[PASS] execute AIO-SX upgrade to 22.12, at the bootstrap end check
        files in /etc/network/
[PASS] finish upgrade and after unlock verify the network access and
        address, interfaces, and route creation in the kernel

Closes-Bug: 2036451

Change-Id: Ib04f72298252a52a8a05cf644671106ad6530e5f
Signed-off-by: Andre Kantek <andrefernandozanella.kantek@windriver.com>
This commit is contained in:
Andre Kantek 2023-09-18 15:05:38 -03:00 committed by Andre Kantek
parent 94f80ab772
commit 4a816dfa6c
2 changed files with 37 additions and 2 deletions

View File

@ -316,8 +316,13 @@ else
parse_interface_stanzas
update_interfaces
update_routes
if [[ ! -f /var/run/.network_upgrade_bootstrap ]]; then
update_interfaces
update_routes
else
log_it "Executing upgrade bootstrap, just add the config files into /etc/network/"
update_config
fi
else
log_it "Not using sysconfig or ifupdown, cannot advance! Aborting..."

View File

@ -626,3 +626,33 @@ function update_routes {
do_cp ${PUPPET_ROUTES_FILE} ${ETC_ROUTES_FILE}
fi
}
function update_config {
# process interfaces
auto_puppet=( $(grep -v HEADER ${PUPPET_DIR}/auto) )
for auto_if in ${auto_puppet[@]:1}; do
cfg="ifcfg-${auto_if}"
do_cp ${PUPPET_DIR}/${cfg} ${ETC_DIR}/${cfg}
done
do_cp ${PUPPET_DIR}/auto ${ETC_DIR}/auto
# process routes
if [ -f ${PUPPET_ROUTES6_FILE} ]; then
log_it "add IPv6 routes generated in network.pp"
if [ -f ${PUPPET_ROUTES_FILE} ]; then
puppet_data=$(grep -v HEADER ${PUPPET_ROUTES6_FILE})
while read route6Line; do
route_exists=$( grep -E "${route6Line}" ${PUPPET_ROUTES_FILE} )
if [ "${route_exists}" == "" ]; then
echo "${route6Line}" >> ${PUPPET_ROUTES_FILE}
fi
done <<< ${puppet_data}
else
cat ${PUPPET_ROUTES6_FILE} >> ${PUPPET_ROUTES_FILE}
fi
fi
if [ -f ${PUPPET_ROUTES_FILE} ]; then
do_cp ${PUPPET_ROUTES_FILE} ${ETC_ROUTES_FILE}
fi
}