From cd7cfef429003224b184626fe3b1ece26d68a3f0 Mon Sep 17 00:00:00 2001
From: Lucas Alvares Gomes <lucasagomes@gmail.com>
Date: Mon, 26 May 2014 14:58:37 +0100
Subject: [PATCH] Ironic: Add deploy kernel and deploy ramdisk to driver_info

Pass deploy kernel and deploy ramdisk as parameters to the driver
to enable Ironic to support different deploy provisioning
methods using the same flavor. This patch is part of the
https://blueprints.launchpad.net/ironic/+spec/add-node-instance-info
work which is separating the instance-level data from the driver-leval
data in the Node's resource of Ironic, once it's finished another patch
will be submitted to DevStack to remove the part of the code which is
adding the deploy kernel and deploy ramdisk parameters to the flavor,
for now a TODO was left inline as a reminder.

Change-Id: Id7cfb17cc6f6133964be139bfedbca1dc644b9cd
Implements: blueprint add-node-instance-info
---
 lib/ironic | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/ironic b/lib/ironic
index 171ac934d4..0656980a89 100644
--- a/lib/ironic
+++ b/lib/ironic
@@ -357,6 +357,8 @@ function enroll_vms {
     while read MAC; do
 
         NODE_ID=$(ironic node-create --chassis_uuid $CHASSIS_ID --driver pxe_ssh \
+            -i pxe_deploy_kernel=$IRONIC_DEPLOY_KERNEL_ID \
+            -i pxe_deploy_ramdisk=$IRONIC_DEPLOY_RAMDISK_ID \
             -i ssh_virt_type=$IRONIC_SSH_VIRT_TYPE \
             -i ssh_address=$IRONIC_VM_SSH_ADDRESS \
             -i ssh_port=$IRONIC_VM_SSH_PORT \
@@ -377,6 +379,10 @@ function enroll_vms {
     # create the nova flavor
     adjusted_disk=$(($IRONIC_VM_SPECS_DISK - $IRONIC_VM_EPHEMERAL_DISK))
     nova flavor-create --ephemeral $IRONIC_VM_EPHEMERAL_DISK baremetal auto $IRONIC_VM_SPECS_RAM $adjusted_disk $IRONIC_VM_SPECS_CPU
+    # TODO(lucasagomes): Remove the 'baremetal:deploy_kernel_id'
+    # and 'baremetal:deploy_ramdisk_id' parameters
+    # from the flavor after the completion of
+    # https://blueprints.launchpad.net/ironic/+spec/add-node-instance-info
     nova flavor-key baremetal set "cpu_arch"="x86_64" "baremetal:deploy_kernel_id"="$IRONIC_DEPLOY_KERNEL_ID" "baremetal:deploy_ramdisk_id"="$IRONIC_DEPLOY_RAMDISK_ID"
 
     # intentional sleep to make sure the tag has been set to port