Make it possible to set a size from within a flavour, and use that for devstack.
This commit is contained in:
parent
ac930076fb
commit
40e954735c
10
README.md
10
README.md
@ -57,6 +57,16 @@ Writing a flavour
|
|||||||
Make as many of the following subdirectories as you need, depending on what
|
Make as many of the following subdirectories as you need, depending on what
|
||||||
part of the process you need to customise:
|
part of the process you need to customise:
|
||||||
|
|
||||||
|
* block-device-size.d: Alter the size (in GB) of the disk image. This is useful
|
||||||
|
when a particular flavour will require a certain minimum (or maximum) size.
|
||||||
|
You can either error and stop the build, or adjust the size to match.
|
||||||
|
NB: Due to the current simple implementation, the last output value wins
|
||||||
|
so this should be used rarely - only one flavour in a mix can reliably set
|
||||||
|
a size.
|
||||||
|
|
||||||
|
* outputs: $IMAGE\_SIZE={size_in_GB}
|
||||||
|
* inputs: $IMAGE_SIZE={size_in_GB}
|
||||||
|
|
||||||
* block-device.d: customise the block device that the image will be made on
|
* block-device.d: customise the block device that the image will be made on
|
||||||
(e.g. to make partitions).
|
(e.g. to make partitions).
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ ensure_nbd
|
|||||||
|
|
||||||
mk_build_dir
|
mk_build_dir
|
||||||
ensure_base_available
|
ensure_base_available
|
||||||
|
eval_run_d block-device-size "IMAGE_SIZE="
|
||||||
|
|
||||||
qemu-img create -f qcow2 $TMP_IMAGE_PATH ${IMAGE_SIZE}G
|
qemu-img create -f qcow2 $TMP_IMAGE_PATH ${IMAGE_SIZE}G
|
||||||
|
|
||||||
@ -60,10 +61,7 @@ fi
|
|||||||
sudo qemu-nbd -c $NBD_DEV $CACHE $TMP_IMAGE_PATH
|
sudo qemu-nbd -c $NBD_DEV $CACHE $TMP_IMAGE_PATH
|
||||||
export EXTRA_UNMOUNT="sudo qemu-nbd -d $NBD_DEV"
|
export EXTRA_UNMOUNT="sudo qemu-nbd -d $NBD_DEV"
|
||||||
export IMAGE_BLOCK_DEVICE=$NBD_DEV
|
export IMAGE_BLOCK_DEVICE=$NBD_DEV
|
||||||
TEMP=`run_d block-device`
|
eval_run_d block-device "IMAGE_BLOCK_DEVICE="
|
||||||
echo "$TEMP"
|
|
||||||
TEMP=`echo "$TEMP" | grep "IMAGE_BLOCK_DEVICE="`
|
|
||||||
eval "$TEMP"
|
|
||||||
|
|
||||||
sudo mkfs -F -t $FS_TYPE -L cloudimg-rootfs ${IMAGE_BLOCK_DEVICE}
|
sudo mkfs -F -t $FS_TYPE -L cloudimg-rootfs ${IMAGE_BLOCK_DEVICE}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ Jenkins
|
|||||||
* Jobs to build:
|
* Jobs to build:
|
||||||
* bootstrap VM from-scratch (archive bootstrap.qcow2).
|
* bootstrap VM from-scratch (archive bootstrap.qcow2).
|
||||||
|
|
||||||
disk-image-create vm devstack -o bootstrap.qcow2 -a i386
|
disk-image-create vm devstack -o bootstrap -a i386
|
||||||
|
|
||||||
* devstack nova-bm execution (archive the resulting image).
|
* devstack nova-bm execution (archive the resulting image).
|
||||||
Chained off of the bootstrap vm build
|
Chained off of the bootstrap vm build
|
||||||
@ -26,17 +26,17 @@ Jenkins
|
|||||||
* bootstrap VM via image-build chain (archive bm-cloud.qcow2).
|
* bootstrap VM via image-build chain (archive bm-cloud.qcow2).
|
||||||
|
|
||||||
disk-image-create vm glance nova-bm swift mysql haproxy-api \
|
disk-image-create vm glance nova-bm swift mysql haproxy-api \
|
||||||
haproxy-mysql cinder quantum rabbitmq -o bootstrap-prod.qcow2
|
haproxy-mysql cinder quantum rabbitmq -o bootstrap-prod
|
||||||
|
|
||||||
* baremetal SPOF node build (archive the resulting image).
|
* baremetal SPOF node build (archive the resulting image).
|
||||||
|
|
||||||
disk-image-create mysql haproxy-mysql haproxy-api local-boot \
|
disk-image-create mysql haproxy-mysql haproxy-api local-boot \
|
||||||
rabbitmq -o baremetal-spof.qcow2
|
rabbitmq -o baremetal-spof
|
||||||
|
|
||||||
* baremetal demo node build (archive the resulting image).
|
* baremetal demo node build (archive the resulting image).
|
||||||
|
|
||||||
disk-image-create vm glance nova-bm swift cinder quantum \
|
disk-image-create vm glance nova-bm swift cinder quantum \
|
||||||
-o bootstrap-prod.qcow2
|
-o bootstrap-prod
|
||||||
|
|
||||||
* ramdisk deploy image buil
|
* ramdisk deploy image buil
|
||||||
|
|
||||||
|
@ -1,2 +1,5 @@
|
|||||||
Creates an image prepped to make a devstack baremetal cloud. See
|
Creates an image prepped to make a devstack baremetal cloud. See
|
||||||
demo/scripts/demo within the built image.
|
demo/scripts/demo within the built image.
|
||||||
|
|
||||||
|
This flavour forces a 16GB image to allow room for Swift, Cinder and instance
|
||||||
|
disk images.
|
||||||
|
9
flavours/devstack/block-device-size.d/10-size
Executable file
9
flavours/devstack/block-device-size.d/10-size
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Add the stack user we recommend folk use.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -x
|
||||||
|
|
||||||
|
if (( '16' '>' $IMAGE_SIZE )); then
|
||||||
|
echo IMAGE_SIZE=16
|
||||||
|
fi
|
@ -34,3 +34,12 @@ function check_flavour () {
|
|||||||
[ -d $TMP_HOOKS_PATH ] || generate_hooks
|
[ -d $TMP_HOOKS_PATH ] || generate_hooks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Run a hook, looking for a regex in its stdout, and eval the matched lines.
|
||||||
|
# $1 is the hook to run
|
||||||
|
# $2 is the regex to look for
|
||||||
|
function eval_run_d () {
|
||||||
|
local TEMP=`run_d $1`
|
||||||
|
echo "$TEMP"
|
||||||
|
TEMP=`echo "$TEMP" | grep "$2"`
|
||||||
|
eval "$TEMP"
|
||||||
|
}
|
||||||
|
@ -7,7 +7,7 @@ FS_TYPE=${FS_TYPE:-ext4}
|
|||||||
# Used to set the file extension only at this stage.
|
# Used to set the file extension only at this stage.
|
||||||
IMAGE_TYPE=${IMAGE_TYPE:-qcow2}
|
IMAGE_TYPE=${IMAGE_TYPE:-qcow2}
|
||||||
IMAGE_NAME=${IMAGE_NAME:-image}
|
IMAGE_NAME=${IMAGE_NAME:-image}
|
||||||
IMAGE_SIZE=${IMAGE_SIZE:-1} # N.B. This size is in GB
|
export IMAGE_SIZE=${IMAGE_SIZE:-1} # N.B. This size is in GB
|
||||||
# Set via the CLI normally.
|
# Set via the CLI normally.
|
||||||
# IMAGE_FLAVOUR=
|
# IMAGE_FLAVOUR=
|
||||||
IMG_PATH=~/.cache/image-create
|
IMG_PATH=~/.cache/image-create
|
||||||
|
Loading…
Reference in New Issue
Block a user