Update ramdisk building to support init hooks for flavours
This commit is contained in:
parent
88a11115f5
commit
6fb8b19b7c
26
flavours/baremetal/init
Normal file
26
flavours/baremetal/init
Normal file
@ -0,0 +1,26 @@
|
||||
if [ -z "$ISCSI_TARGET_IQN" ]; then
|
||||
echo "iscsi_target_iqn is not defined"
|
||||
echo "Starting troubleshooting shell."
|
||||
bash
|
||||
fi
|
||||
|
||||
target_disk=`find_disk "$DISK"`
|
||||
echo "start iSCSI target on $target_disk"
|
||||
start_iscsi_target "$ISCSI_TARGET_IQN" "$target_disk" ALL
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Could not find disk to use."
|
||||
echo "Starting troubleshooting shell."
|
||||
bash
|
||||
fi
|
||||
|
||||
echo "request boot server to deploy image"
|
||||
d="i=$DEPLOYMENT_ID&k=$DEPLOYMENT_KEY&a=$BOOT_IP_ADDRESS&n=$ISCSI_TARGET_IQN"
|
||||
wget --post-data "$d" "http://$BOOT_SERVER:10000"
|
||||
|
||||
echo "waiting for notice of complete"
|
||||
nc -l -p 10000
|
||||
|
||||
echo "stop iSCSI target on $target_disk"
|
||||
|
||||
stop_iscsi_target
|
||||
|
4
flavours/hwburnin/init
Normal file
4
flavours/hwburnin/init
Normal file
@ -0,0 +1,4 @@
|
||||
echo "Starting HW Burnin"
|
||||
memtester 1G 10 # XXX: Discover RAM size
|
||||
# XXX: Discover and test disks with spew
|
||||
|
5
flavours/hwdiscovery/init
Normal file
5
flavours/hwdiscovery/init
Normal file
@ -0,0 +1,5 @@
|
||||
echo "Starting HW Discovery"
|
||||
# XXX: Collect iLO specific data, bundle everything up and POST it somewhere
|
||||
lshw -json # XXX: Do something with this
|
||||
sleep 30
|
||||
|
@ -107,6 +107,22 @@ function populate_init () {
|
||||
for F in "$FUNCTIONS_D"/* ; do
|
||||
cp "$F" "$TMP_MOUNT_PATH"
|
||||
done
|
||||
|
||||
# Append /init with any flavour fragments that are present
|
||||
for _FLVR in ${RAMDISK_FLAVOUR} ; do
|
||||
_FILE="${FLAVOURS_DIR}/${_FLVR}/init"
|
||||
if [ -a $_FILE ]; then
|
||||
cat >>$TMP_MOUNT_PATH/init <<EOF
|
||||
|
||||
# init fragment from ${_FLVR}
|
||||
EOF
|
||||
cat <$_FILE >>$TMP_MOUNT_PATH/init
|
||||
fi
|
||||
done
|
||||
|
||||
# Add our final steps to /init
|
||||
cat <${INIT}-end >>$TMP_MOUNT_PATH/init
|
||||
|
||||
}
|
||||
|
||||
function finalise_image () {
|
||||
|
53
scripts/init
53
scripts/init
@ -34,8 +34,6 @@ mount -t proc proc /proc
|
||||
|
||||
readonly _BOOTIF_=$(get_kernel_parameter BOOTIF)
|
||||
readonly _IP_=$(get_kernel_parameter ip)
|
||||
readonly _CMDLINE_FLAVOUR=$(get_kernel_parameter FLAVOUR)
|
||||
readonly FLAVOUR=${_CMDLINE_FLAVOUR:-baremetal}
|
||||
readonly BOOT_MAC_ADDRESS=$(echo "$_BOOTIF_" | sed -e "s/-/:/g" | sed -e "s/^01://g" | tr 'a-f' 'A-F')
|
||||
readonly BOOT_IP_ADDRESS=$(echo "$_IP_" | cut -d':' -f1)
|
||||
readonly BOOT_SERVER=$(echo "$_IP_" | cut -d':' -f2)
|
||||
@ -47,13 +45,6 @@ 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)
|
||||
|
||||
string_contains $FLAVOUR "baremetal"
|
||||
if [ "$?" == "0" -a -z "$ISCSI_TARGET_IQN" ]; then
|
||||
echo "iscsi_target_iqn is not defined"
|
||||
echo "Starting troubleshooting shell."
|
||||
bash
|
||||
fi
|
||||
|
||||
mount -t sysfs none /sys
|
||||
mount -t tmpfs none /dev
|
||||
ln -sf /proc/self/fd /dev/fd
|
||||
@ -132,47 +123,3 @@ done
|
||||
|
||||
echo "network ready"
|
||||
|
||||
string_contains $FLAVOUR "baremetal"
|
||||
if [ "$?" == "0" ]; then
|
||||
target_disk=`find_disk "$DISK"`
|
||||
echo "start iSCSI target on $target_disk"
|
||||
start_iscsi_target "$ISCSI_TARGET_IQN" "$target_disk" ALL
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Could not find disk to use."
|
||||
echo "Starting troubleshooting shell."
|
||||
bash
|
||||
fi
|
||||
|
||||
echo "request boot server to deploy image"
|
||||
d="i=$DEPLOYMENT_ID&k=$DEPLOYMENT_KEY&a=$BOOT_IP_ADDRESS&n=$ISCSI_TARGET_IQN"
|
||||
wget --post-data "$d" "http://$BOOT_SERVER:10000"
|
||||
|
||||
echo "waiting for notice of complete"
|
||||
nc -l -p 10000
|
||||
|
||||
echo "stop iSCSI target on $target_disk"
|
||||
|
||||
stop_iscsi_target
|
||||
fi
|
||||
|
||||
string_contains $FLAVOUR "hwdiscovery"
|
||||
if [ "$?" == "0" ]; then
|
||||
echo "Starting HW Discovery"
|
||||
# XXX: Collect iLO specific data, bundle everything up and POST it somewhere
|
||||
lshw -json # XXX: Do something with this
|
||||
sleep 30
|
||||
fi
|
||||
|
||||
string_contains $FLAVOUR "hwburnin"
|
||||
if [ "$?" == "0" ]; then
|
||||
echo "Starting HW Burnin"
|
||||
memtester 1G 10 # XXX: Discover RAM size
|
||||
# XXX: Discover and test disks with spew
|
||||
fi
|
||||
|
||||
echo "rebooting"
|
||||
reboot -f
|
||||
|
||||
echo "failed to reboot"
|
||||
echo "Starting troubleshooting shell."
|
||||
bash
|
||||
|
11
scripts/init-end
Normal file
11
scripts/init-end
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
|
||||
# Final init steps
|
||||
|
||||
echo "rebooting"
|
||||
reboot -f
|
||||
|
||||
echo "failed to reboot"
|
||||
echo "Starting troubleshooting shell."
|
||||
bash
|
||||
|
Loading…
Reference in New Issue
Block a user