From d3a18ae1ecc757008ee7686f709209a930d90ab8 Mon Sep 17 00:00:00 2001 From: Arata Notsu Date: Fri, 2 Aug 2013 20:58:56 +0900 Subject: [PATCH] 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 --- lib/baremetal | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/lib/baremetal b/lib/baremetal index 145544d40c..8f6c3f1660 100644 --- a/lib/baremetal +++ b/lib/baremetal @@ -138,9 +138,12 @@ BM_FLAVOR_ARCH=${BM_FLAVOR_ARCH:-$BM_CPU_ARCH} BM_IMAGE_BUILD_DIR=${BM_IMAGE_BUILD_DIR:-$DEST/diskimage-builder} BM_POSEUR_DIR=${BM_POSEUR_DIR:-$DEST/bm_poseur} -BM_HOST_CURRENT_KERNEL=$(uname -r) -BM_DEPLOY_RAMDISK=${BM_DEPLOY_RAMDISK:-bm-deploy-$BM_HOST_CURRENT_KERNEL-initrd} -BM_DEPLOY_KERNEL=${BM_DEPLOY_KERNEL:-bm-deploy-$BM_HOST_CURRENT_KERNEL-vmlinuz} +# Use DIB to create deploy ramdisk and kernel. +BM_BUILD_DEPLOY_RAMDISK=`trueorfalse True $BM_BUILD_DEPLOY_RAMDISK` +# If not use DIB, these files are used as deploy ramdisk/kernel. +# (The value must be a relative path from $TOP_DIR/files/) +BM_DEPLOY_RAMDISK=${BM_DEPLOY_RAMDISK:-} +BM_DEPLOY_KERNEL=${BM_DEPLOY_KERNEL:-} # If you need to add any extra flavors to the deploy ramdisk image # eg, specific network drivers, specify them here @@ -233,13 +236,13 @@ function configure_baremetal_nova_dirs() { function upload_baremetal_deploy() { token=$1 - if [ ! -e $TOP_DIR/files/$BM_DEPLOY_KERNEL -a -e /boot/vmlinuz-$BM_HOST_CURRENT_KERNEL ]; then - sudo cp /boot/vmlinuz-$BM_HOST_CURRENT_KERNEL $TOP_DIR/files/$BM_DEPLOY_KERNEL - sudo chmod a+r $TOP_DIR/files/$BM_DEPLOY_KERNEL - fi - if [ ! -e $TOP_DIR/files/$BM_DEPLOY_RAMDISK ]; then - $BM_IMAGE_BUILD_DIR/bin/ramdisk-image-create $BM_DEPLOY_FLAVOR deploy \ - -o $TOP_DIR/files/$BM_DEPLOY_RAMDISK -k $BM_HOST_CURRENT_KERNEL + if [ "$BM_BUILD_DEPLOY_RAMDISK" = "True" ]; then + BM_DEPLOY_KERNEL=bm-deploy.kernel + BM_DEPLOY_RAMDISK=bm-deploy.initramfs + if [ ! -e "$TOP_DIR/files/$BM_DEPLOY_KERNEL" -o ! -e "$TOP_DIR/files/$BM_DEPLOY_RAMDISK" ]; then + $BM_IMAGE_BUILD_DIR/bin/ramdisk-image-create $BM_DEPLOY_FLAVOR deploy \ + -o $TOP_DIR/files/bm-deploy + fi fi # load them into glance