Add vmedia boot support for deploy-ironic element

deploy-ironic element currently retrieves token over tftp and
expects BOOT_IP_ADDRESS to be set.  This commit adds support for
retrieving token file from virtual media if node booted from
virtual media. Also corrects the issue for BOOT_IP_ADDRESS not set
for virtual media boot.

Change-Id: I3d5f1779b9b17842360860c7778baa01db1e1a52
Closes-Bug: #1356339
This commit is contained in:
Ramakrishnan G 2014-08-13 21:51:04 +05:30 committed by Anusha Ramineni
parent 9fb2c1425a
commit 10d72ddb22
2 changed files with 18 additions and 7 deletions

View File

@ -26,11 +26,19 @@ if [ $? -ne 0 ]; then
troubleshoot troubleshoot
fi fi
TOKEN_FILE=token-$DEPLOYMENT_ID if [ "$BOOT_METHOD" = "$VMEDIA_BOOT_TAG" ]; then
TOKEN_FILE="$VMEDIA_DIR/token"
if [ -f "$TOKEN_FILE" ]; then
TOKEN_HEADER="-H 'X-Auth-Token: $(cat $TOKEN_FILE)'"
else TOKEN_HEADER=""
fi
else
TOKEN_FILE=token-$DEPLOYMENT_ID
if tftp -r $TOKEN_FILE -g $BOOT_SERVER if tftp -r $TOKEN_FILE -g $BOOT_SERVER
then TOKEN_HEADER="-H 'X-Auth-Token: `cat $TOKEN_FILE`'" then TOKEN_HEADER="-H 'X-Auth-Token: $(cat $TOKEN_FILE)'"
else TOKEN_HEADER="" else TOKEN_HEADER=""
fi
fi fi
DATA="'{\"address\":\"$BOOT_IP_ADDRESS\",\"key\":\"$DEPLOYMENT_KEY\",\"iqn\":\"$ISCSI_TARGET_IQN\",\"error\":\"$FIRST_ERR_MSG\"}'" DATA="'{\"address\":\"$BOOT_IP_ADDRESS\",\"key\":\"$DEPLOYMENT_KEY\",\"iqn\":\"$ISCSI_TARGET_IQN\",\"error\":\"$FIRST_ERR_MSG\"}'"

View File

@ -105,10 +105,13 @@ readonly _BOOTIF_=$(get_kernel_parameter BOOTIF)
readonly _IP_=$(get_kernel_parameter ip) readonly _IP_=$(get_kernel_parameter ip)
readonly BOOT_MAC_ADDRESS=$(echo "$_BOOTIF_" | sed -e "s/-/:/g" | \ readonly BOOT_MAC_ADDRESS=$(echo "$_BOOTIF_" | sed -e "s/-/:/g" | \
sed -e "s/^01://g" | tr 'a-f' 'A-F') 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) readonly BOOT_SERVER=$(echo "$_IP_" | cut -d':' -f2)
readonly BOOT_NETMASK=$(echo "$_IP_" | cut -d':' -f4)
readonly BOOT_GATEWAY=$(echo "$_IP_" | cut -d':' -f3) # IP address, netmask, gateway can be set a later point of time if
# IP address is assigned by dhcp (for non-pxe boots).
BOOT_IP_ADDRESS=$(echo "$_IP_" | cut -d':' -f1)
BOOT_NETMASK=$(echo "$_IP_" | cut -d':' -f4)
BOOT_GATEWAY=$(echo "$_IP_" | cut -d':' -f3)
readonly DISK=$(get_kernel_parameter disk) readonly DISK=$(get_kernel_parameter disk)