Skip to content

Commit cfe247e

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Ironic and baremetal install diskimage-builder with pip"
2 parents 33dc869 + cbfb3ae commit cfe247e

2 files changed

Lines changed: 9 additions & 12 deletions

File tree

lib/baremetal

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,6 @@ BM_FLAVOR_ID=${BM_FLAVOR_ID:-11}
127127
BM_FLAVOR_ARCH=${BM_FLAVOR_ARCH:-$BM_CPU_ARCH}
128128

129129

130-
# Below this, we set some path and filenames.
131-
# Defaults are probably sufficient.
132-
DIB_DIR=${DIB_DIR:-$DEST/diskimage-builder}
133-
134130
# Use DIB to create deploy ramdisk and kernel.
135131
BM_BUILD_DEPLOY_RAMDISK=`trueorfalse True $BM_BUILD_DEPLOY_RAMDISK`
136132
# If not use DIB, these files are used as deploy ramdisk/kernel.
@@ -165,8 +161,9 @@ function is_baremetal {
165161
# Install diskimage-builder and shell-in-a-box
166162
# so that we can build the deployment kernel & ramdisk
167163
function prepare_baremetal_toolchain {
168-
git_clone $DIB_REPO $DIB_DIR $DIB_BUILD_BRANCH
169-
164+
if [[ $(type -P ramdisk-image-create) == "" ]]; then
165+
pip_install diskimage_builder
166+
fi
170167
local shellinabox_basename=$(basename $BM_SHELL_IN_A_BOX)
171168
if [[ ! -e $DEST/$shellinabox_basename ]]; then
172169
cd $DEST
@@ -223,7 +220,7 @@ function upload_baremetal_deploy {
223220
BM_DEPLOY_KERNEL=bm-deploy.kernel
224221
BM_DEPLOY_RAMDISK=bm-deploy.initramfs
225222
if [ ! -e "$TOP_DIR/files/$BM_DEPLOY_KERNEL" -o ! -e "$TOP_DIR/files/$BM_DEPLOY_RAMDISK" ]; then
226-
$DIB_DIR/bin/ramdisk-image-create $BM_DEPLOY_FLAVOR \
223+
ramdisk-image-create $BM_DEPLOY_FLAVOR \
227224
-o $TOP_DIR/files/bm-deploy
228225
fi
229226
fi
@@ -271,7 +268,7 @@ function extract_and_upload_k_and_r_from_image {
271268
image_name=$(basename "$file" ".qcow2")
272269

273270
# this call returns the file names as "$kernel,$ramdisk"
274-
out=$($DIB_DIR/bin/disk-image-get-kernel \
271+
out=$(disk-image-get-kernel \
275272
-x -d $TOP_DIR/files -o bm-deploy -i $file)
276273
if [ $? -ne 0 ]; then
277274
die $LINENO "Failed to get kernel and ramdisk from $file"

lib/ironic

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ IRONIC_AUTHORIZED_KEYS_FILE=${IRONIC_AUTHORIZED_KEYS_FILE:-$HOME/.ssh/authorized
6666
IRONIC_VM_LOG_CONSOLE=${IRONIC_VM_LOG_CONSOLE:-True}
6767
IRONIC_VM_LOG_DIR=${IRONIC_VM_LOG_DIR:-$IRONIC_DATA_DIR/logs/}
6868

69-
DIB_DIR=${DIB_DIR:-$DEST/diskimage-builder}
70-
7169
# Use DIB to create deploy ramdisk and kernel.
7270
IRONIC_BUILD_DEPLOY_RAMDISK=`trueorfalse True $IRONIC_BUILD_DEPLOY_RAMDISK`
7371
# If not use DIB, these files are used as deploy ramdisk/kernel.
@@ -498,7 +496,9 @@ function upload_baremetal_ironic_deploy {
498496
echo_summary "Creating and uploading baremetal images for ironic"
499497

500498
# install diskimage-builder
501-
git_clone $DIB_REPO $DIB_DIR $DIB_BRANCH
499+
if [[ $(type -P ramdisk-image-create) == "" ]]; then
500+
pip_install diskimage_builder
501+
fi
502502

503503
if [ -z "$IRONIC_DEPLOY_KERNEL" -o -z "$IRONIC_DEPLOY_RAMDISK" ]; then
504504
local IRONIC_DEPLOY_KERNEL_PATH=$TOP_DIR/files/ir-deploy.kernel
@@ -516,7 +516,7 @@ function upload_baremetal_ironic_deploy {
516516
if [ "$IRONIC_DEPLOY_RAMDISK" == "agent_ssh" ]; then
517517
die $LINENO "Ironic-python-agent build is not yet supported"
518518
else
519-
$DIB_DIR/bin/ramdisk-image-create $IRONIC_DEPLOY_FLAVOR \
519+
ramdisk-image-create $IRONIC_DEPLOY_FLAVOR \
520520
-o $TOP_DIR/files/ir-deploy
521521
fi
522522
else

0 commit comments

Comments
 (0)