Browse code

Update baremetal to work with the latest DIB

Adjust DevStack to the current DIB's naming to kernel/ramdisk.

BM_HOST_CURRENT_KERNEL is removed since the kernel is extracted from
a diskimage with the ramdisk and the host's kernel is not used.

BM_BUILD_DEPLOY_RAMDISK is added to control whether use DIB or not.

If you set BM_BUILD_DEPLOY_RAMDISK=False, you must BM_DEPLOY_KERNEL
and BM_DEPLOY_RAMDISK to point existing deploy kernel/ramdisk.

Fixes bug 1207719

Change-Id: I62af0b1942b07ac12665c0ed3619d64c1cccbe1f

Arata Notsu authored on 2013/08/02 20:58:56
Showing 1 changed files
... ...
@@ -138,9 +138,12 @@ BM_FLAVOR_ARCH=${BM_FLAVOR_ARCH:-$BM_CPU_ARCH}
138 138
 BM_IMAGE_BUILD_DIR=${BM_IMAGE_BUILD_DIR:-$DEST/diskimage-builder}
139 139
 BM_POSEUR_DIR=${BM_POSEUR_DIR:-$DEST/bm_poseur}
140 140
 
141
-BM_HOST_CURRENT_KERNEL=$(uname -r)
142
-BM_DEPLOY_RAMDISK=${BM_DEPLOY_RAMDISK:-bm-deploy-$BM_HOST_CURRENT_KERNEL-initrd}
143
-BM_DEPLOY_KERNEL=${BM_DEPLOY_KERNEL:-bm-deploy-$BM_HOST_CURRENT_KERNEL-vmlinuz}
141
+# Use DIB to create deploy ramdisk and kernel.
142
+BM_BUILD_DEPLOY_RAMDISK=`trueorfalse True $BM_BUILD_DEPLOY_RAMDISK`
143
+# If not use DIB, these files are used as deploy ramdisk/kernel.
144
+# (The value must be a relative path from $TOP_DIR/files/)
145
+BM_DEPLOY_RAMDISK=${BM_DEPLOY_RAMDISK:-}
146
+BM_DEPLOY_KERNEL=${BM_DEPLOY_KERNEL:-}
144 147
 
145 148
 # If you need to add any extra flavors to the deploy ramdisk image
146 149
 # eg, specific network drivers, specify them here
... ...
@@ -233,13 +236,13 @@ function configure_baremetal_nova_dirs() {
233 233
 function upload_baremetal_deploy() {
234 234
     token=$1
235 235
 
236
-    if [ ! -e $TOP_DIR/files/$BM_DEPLOY_KERNEL -a -e /boot/vmlinuz-$BM_HOST_CURRENT_KERNEL ]; then
237
-        sudo cp /boot/vmlinuz-$BM_HOST_CURRENT_KERNEL $TOP_DIR/files/$BM_DEPLOY_KERNEL
238
-        sudo chmod a+r $TOP_DIR/files/$BM_DEPLOY_KERNEL
239
-    fi
240
-    if [ ! -e $TOP_DIR/files/$BM_DEPLOY_RAMDISK ]; then
241
-       $BM_IMAGE_BUILD_DIR/bin/ramdisk-image-create $BM_DEPLOY_FLAVOR deploy \
242
-           -o $TOP_DIR/files/$BM_DEPLOY_RAMDISK -k $BM_HOST_CURRENT_KERNEL
236
+    if [ "$BM_BUILD_DEPLOY_RAMDISK" = "True" ]; then
237
+        BM_DEPLOY_KERNEL=bm-deploy.kernel
238
+        BM_DEPLOY_RAMDISK=bm-deploy.initramfs
239
+        if [ ! -e "$TOP_DIR/files/$BM_DEPLOY_KERNEL" -o ! -e "$TOP_DIR/files/$BM_DEPLOY_RAMDISK" ]; then
240
+            $BM_IMAGE_BUILD_DIR/bin/ramdisk-image-create $BM_DEPLOY_FLAVOR deploy \
241
+                -o $TOP_DIR/files/bm-deploy
242
+        fi
243 243
     fi
244 244
 
245 245
     # load them into glance