Ironic and baremetal install diskimage-builder with pip
This change installs diskimage-builder with pip instead of from git, and only if the executable ramdisk-image-create isn't already installed. This allows the ironic and baremetal to consume the latest release of diskimage-builder by default, and gives the option of defining version constraints for which version to install. If the dib service is enabled (which it isn't by default) then diskimage-builder will already be installed from git and will not be re-installed for ironic and diskimage-builder. Change-Id: Ic6613a11e2c4fb7a1261b81cdc2cf958515e60cd
This commit is contained in:
parent
f8f97a677a
commit
cbfb3ae1c8
@ -127,10 +127,6 @@ BM_FLAVOR_ID=${BM_FLAVOR_ID:-11}
|
||||
BM_FLAVOR_ARCH=${BM_FLAVOR_ARCH:-$BM_CPU_ARCH}
|
||||
|
||||
|
||||
# Below this, we set some path and filenames.
|
||||
# Defaults are probably sufficient.
|
||||
DIB_DIR=${DIB_DIR:-$DEST/diskimage-builder}
|
||||
|
||||
# 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.
|
||||
@ -165,8 +161,9 @@ function is_baremetal {
|
||||
# Install diskimage-builder and shell-in-a-box
|
||||
# so that we can build the deployment kernel & ramdisk
|
||||
function prepare_baremetal_toolchain {
|
||||
git_clone $DIB_REPO $DIB_DIR $DIB_BUILD_BRANCH
|
||||
|
||||
if [[ $(type -P ramdisk-image-create) == "" ]]; then
|
||||
pip_install diskimage_builder
|
||||
fi
|
||||
local shellinabox_basename=$(basename $BM_SHELL_IN_A_BOX)
|
||||
if [[ ! -e $DEST/$shellinabox_basename ]]; then
|
||||
cd $DEST
|
||||
@ -223,7 +220,7 @@ function upload_baremetal_deploy {
|
||||
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
|
||||
$DIB_DIR/bin/ramdisk-image-create $BM_DEPLOY_FLAVOR \
|
||||
ramdisk-image-create $BM_DEPLOY_FLAVOR \
|
||||
-o $TOP_DIR/files/bm-deploy
|
||||
fi
|
||||
fi
|
||||
@ -271,7 +268,7 @@ function extract_and_upload_k_and_r_from_image {
|
||||
image_name=$(basename "$file" ".qcow2")
|
||||
|
||||
# this call returns the file names as "$kernel,$ramdisk"
|
||||
out=$($DIB_DIR/bin/disk-image-get-kernel \
|
||||
out=$(disk-image-get-kernel \
|
||||
-x -d $TOP_DIR/files -o bm-deploy -i $file)
|
||||
if [ $? -ne 0 ]; then
|
||||
die $LINENO "Failed to get kernel and ramdisk from $file"
|
||||
|
@ -66,8 +66,6 @@ IRONIC_AUTHORIZED_KEYS_FILE=${IRONIC_AUTHORIZED_KEYS_FILE:-$HOME/.ssh/authorized
|
||||
IRONIC_VM_LOG_CONSOLE=${IRONIC_VM_LOG_CONSOLE:-True}
|
||||
IRONIC_VM_LOG_DIR=${IRONIC_VM_LOG_DIR:-$IRONIC_DATA_DIR/logs/}
|
||||
|
||||
DIB_DIR=${DIB_DIR:-$DEST/diskimage-builder}
|
||||
|
||||
# Use DIB to create deploy ramdisk and kernel.
|
||||
IRONIC_BUILD_DEPLOY_RAMDISK=`trueorfalse True $IRONIC_BUILD_DEPLOY_RAMDISK`
|
||||
# If not use DIB, these files are used as deploy ramdisk/kernel.
|
||||
@ -498,7 +496,9 @@ function upload_baremetal_ironic_deploy {
|
||||
echo_summary "Creating and uploading baremetal images for ironic"
|
||||
|
||||
# install diskimage-builder
|
||||
git_clone $DIB_REPO $DIB_DIR $DIB_BRANCH
|
||||
if [[ $(type -P ramdisk-image-create) == "" ]]; then
|
||||
pip_install diskimage_builder
|
||||
fi
|
||||
|
||||
if [ -z "$IRONIC_DEPLOY_KERNEL" -o -z "$IRONIC_DEPLOY_RAMDISK" ]; then
|
||||
local IRONIC_DEPLOY_KERNEL_PATH=$TOP_DIR/files/ir-deploy.kernel
|
||||
@ -516,7 +516,7 @@ function upload_baremetal_ironic_deploy {
|
||||
if [ "$IRONIC_DEPLOY_RAMDISK" == "agent_ssh" ]; then
|
||||
die $LINENO "Ironic-python-agent build is not yet supported"
|
||||
else
|
||||
$DIB_DIR/bin/ramdisk-image-create $IRONIC_DEPLOY_FLAVOR \
|
||||
ramdisk-image-create $IRONIC_DEPLOY_FLAVOR \
|
||||
-o $TOP_DIR/files/ir-deploy
|
||||
fi
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user