Wait up to 30 seconds for config drive
Handle Virtual Media ISO (sr0) appearing later
Issue: https://bugs.launchpad.net/ironic-python-agent-builder/+bug/2126068
Change-Id: I185f0955d86767784ea6b68c01ffc484c83c61ae
Signed-off-by: Mathieu Parent <math.parent@gmail.com>
(cherry picked from commit 9aca8fd38f)
This commit is contained in:
committed by
Doug Goldstein
parent
2a5899d13a
commit
b1904e5fbc
@@ -3,6 +3,8 @@ Description=Ironic agent config drive setup
|
||||
Wants=network-pre.target
|
||||
Before=network-pre.target
|
||||
After=local-fs.target
|
||||
Before=glean.service
|
||||
Before=system-glean.slice
|
||||
|
||||
[Service]
|
||||
ExecStart=/bin/bash /usr/local/bin/ironic-python-agent-resolve-configdrive.sh
|
||||
|
||||
@@ -10,19 +10,27 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
||||
# Inspired by/based on glean-early.sh
|
||||
# https://opendev.org/opendev/glean/src/branch/master/glean/init/glean-early.sh
|
||||
|
||||
# NOTE(TheJulia): We care about iso images, and would expect lower case as a
|
||||
# result. In the case of VFAT partitions, they would be upper case.
|
||||
CONFIG_DRIVE_LABEL="config-2"
|
||||
|
||||
# Identify the number of devices
|
||||
device_count=$(lsblk -o PATH,LABEL | grep -c $CONFIG_DRIVE_LABEL || true)
|
||||
|
||||
# Identify if we have an a publisher id set
|
||||
publisher_id=""
|
||||
if grep -q "ir_pub_id" /proc/cmdline; then
|
||||
publisher_id=$(cat /proc/cmdline | sed -e 's/^.*ir_pub_id=//' -e 's/ .*$//')
|
||||
fi
|
||||
|
||||
# NOTE(TheJulia): We care about iso images, and would expect lower case as a
|
||||
# result. In the case of VFAT partitions, they would be upper case.
|
||||
CONFIG_DRIVE_LABEL="config-2"
|
||||
|
||||
i=0
|
||||
while [ $i -lt 30 ] ; do
|
||||
i=$((i + 1))
|
||||
|
||||
# Identify the number of devices
|
||||
device_count=$(lsblk -o PATH,LABEL | grep -c $CONFIG_DRIVE_LABEL || true)
|
||||
|
||||
[ $device_count -lt 1 ] || break
|
||||
sleep 1
|
||||
done
|
||||
|
||||
if [ $device_count -lt 1 ]; then
|
||||
# Nothing to do here, exit!
|
||||
exit 0
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Wait config drive up to 30 seconds. This ensure that network data is available to Glean.
|
||||
Reference in New Issue
Block a user