Make bash troubleshooting configurable
Adds a new 'troubleshooting' function which encapsulates the things we might want to do when something bad happens. Typically this is echo'ing a simple message and launching a bash shell. The new troubleshooting function also makes use of a new 'troubleshoot' kernel param which if specific will allow you to hang the deployment process and interactively debug the deploy_ramdisk via a bash shell on a console. Troubleshoot is disabled by default. Fixes LP Bug #1191043. Change-Id: I2cba8a9674075ba7e420027d40ef8cbe756cf07e
This commit is contained in:
parent
207aeced03
commit
0ff82aff46
@ -1,7 +1,6 @@
|
||||
if [ -z "$ISCSI_TARGET_IQN" ]; then
|
||||
echo "iscsi_target_iqn is not defined"
|
||||
echo "Starting troubleshooting shell."
|
||||
bash
|
||||
troubleshoot
|
||||
fi
|
||||
|
||||
t=0
|
||||
@ -15,16 +14,14 @@ done
|
||||
|
||||
if [ -z "$target_disk" ]; then
|
||||
echo "Could not find disk to use."
|
||||
echo "Starting troubleshooting shell."
|
||||
bash
|
||||
troubleshoot
|
||||
fi
|
||||
|
||||
echo "start iSCSI target on $target_disk"
|
||||
start_iscsi_target "$ISCSI_TARGET_IQN" "$target_disk" ALL
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to start iscsi target."
|
||||
echo "Starting troubleshooting shell."
|
||||
bash
|
||||
troubleshoot
|
||||
fi
|
||||
|
||||
echo "request boot server to deploy image"
|
||||
|
@ -188,4 +188,10 @@ function stop_iscsi_target() {
|
||||
killall tgtd
|
||||
}
|
||||
|
||||
function troubleshoot() {
|
||||
if [ "$TROUBLESHOOT" == 1 ]; then
|
||||
echo "Starting troubleshooting shell."
|
||||
bash
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -47,6 +47,7 @@ readonly DISK=$(get_kernel_parameter disk)
|
||||
readonly DEPLOYMENT_ID=$(get_kernel_parameter deployment_id)
|
||||
readonly DEPLOYMENT_KEY=$(get_kernel_parameter deployment_key)
|
||||
readonly ISCSI_TARGET_IQN=$(get_kernel_parameter iscsi_target_iqn)
|
||||
readonly TROUBLESHOOT=$(get_kernel_parameter troubleshoot)
|
||||
|
||||
mount -t sysfs none /sys
|
||||
|
||||
@ -110,8 +111,7 @@ while ! BOOT_INTERFACE=$(find_interface "$BOOT_MAC_ADDRESS"); do
|
||||
done
|
||||
if [ -z "$BOOT_INTERFACE" ]; then
|
||||
echo "could not find an interface owns MAC=$BOOT_MAC_ADDRESS"
|
||||
echo "Starting troubleshooting shell."
|
||||
bash
|
||||
troubleshoot
|
||||
fi
|
||||
|
||||
readonly BOOT_INTERFACE
|
||||
@ -123,8 +123,7 @@ if [ $? -ne 0 ]; then
|
||||
ifconfig "$BOOT_INTERFACE" up
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to up $BOOT_INTERFACE"
|
||||
echo "Starting troubleshooting shell."
|
||||
bash
|
||||
troubleshoot
|
||||
fi
|
||||
fi
|
||||
ifconfig "$BOOT_INTERFACE" "$BOOT_IP_ADDRESS" netmask "$BOOT_NETMASK"
|
||||
|
Loading…
Reference in New Issue
Block a user