Rename flavour to element.

Flavour is overloaded in openstack due to it being used by nova. Element
seems to have the same feeling of combinability without using a term already
in active use in the openstack community.

Change-Id: Ia4c028d4062a8f69c66665821c94dd4bcdf06031
This commit is contained in:
Monty Taylor 2012-11-30 12:47:57 -08:00
parent e1bc989c2c
commit 1eff4a436e
80 changed files with 48 additions and 48 deletions

View File

@ -8,10 +8,10 @@ in the demo repository, while the reusable tools live here.
What tools are there? What tools are there?
--------------------- ---------------------
* disk-image-create -o filename {flavour} [{flavour} ...] : Create an image of * disk-image-create -o filename {element} [{element} ...] : Create an image of
flavour {flavour}, optionally mixing in other flavours. element {element}, optionally mixing in other elements.
* ramdisk-image-create -o filename {flavour} [{flavour} ...] : Create a kernel+ * ramdisk-image-create -o filename {element} [{element} ...] : Create a kernel+
ramdisk pair for running maintenance on bare metal machines (deployment, ramdisk pair for running maintenance on bare metal machines (deployment,
inventory, burnin etc). inventory, burnin etc).
@ -20,7 +20,7 @@ What tools are there?
* disk-image-get-kernel filename : Extract the appropriate kernel and ramdisk * disk-image-get-kernel filename : Extract the appropriate kernel and ramdisk
to use when doing PXE boot using filename as the image for a machine. to use when doing PXE boot using filename as the image for a machine.
* flavours can be found in the top level flavours directory. * elements can be found in the top level elements directory.
Why? Why?
---- ----
@ -36,12 +36,12 @@ of the image building process is to produce blank slate machines that have all
the necessary bits to fulfill a specific purpose in the running of an Openstack the necessary bits to fulfill a specific purpose in the running of an Openstack
cloud: e.g. a nova-compute node. cloud: e.g. a nova-compute node.
A flavour is a particular set of code that alters how the image is built, or An element is a particular set of code that alters how the image is built, or
runs within the chroot to prepare the image. E.g. the local-config flavour runs within the chroot to prepare the image. E.g. the local-config element
copies in the http proxy and ssh keys of the user running the image build copies in the http proxy and ssh keys of the user running the image build
process into the image, whereas the vm flavour makes the image build a regular process into the image, whereas the vm element makes the image build a regular
VM image with partition table and installed grub boot sector. The mellanox VM image with partition table and installed grub boot sector. The mellanox
flavour adds support for mellanox infiniband hardware to both the deploy element adds support for mellanox infiniband hardware to both the deploy
ramdisk and the built images. ramdisk and the built images.
Images start as a base ubuntu cloud image. Other distributions may be added in Images start as a base ubuntu cloud image. Other distributions may be added in
@ -71,24 +71,24 @@ the correct global content and are ready for 'last-mile' configuration by the
nova metadata API, after which a configuration management system can take over nova metadata API, after which a configuration management system can take over
(until the next deploy, when it all starts over from scratch). (until the next deploy, when it all starts over from scratch).
Existing flavours Existing elements
----------------- -----------------
Flavours are found in the subdirectory flavours. Each flavour is in a directory Elements are found in the subdirectory elements. Each element is in a directory
named after the flavour itself. Flavours *should* have a README.md in the root named after the element itself. Elements *should* have a README.md in the root
of the flavour directory describing what it is for. of the element directory describing what it is for.
Writing a flavour Writing an element
----------------- -----------------
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 * 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. when a particular element will require a certain minimum (or maximum) size.
You can either error and stop the build, or adjust the size to match. 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 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 so this should be used rarely - only one element in a mix can reliably set
a size. a size.
* outputs: $IMAGE\_SIZE={size_in_GB} * outputs: $IMAGE\_SIZE={size_in_GB}
@ -117,7 +117,7 @@ part of the process you need to customise:
* first-boot.d: Runs inside the image before rc.local. Scripts from here are * first-boot.d: Runs inside the image before rc.local. Scripts from here are
good for doing per-instance configuration based on cloud metadata. good for doing per-instance configuration based on cloud metadata.
Ramdisk flavours support the following files in their flavour directories: Ramdisk elements support the following files in their element directories:
* binary-deps : executables required to be fed into the ramdisk. These need * binary-deps : executables required to be fed into the ramdisk. These need
to be present in your $PATH. to be present in your $PATH.
@ -125,10 +125,10 @@ Ramdisk flavours support the following files in their flavour directories:
* init : a POSIX shell script fragment that will be appended to the default * init : a POSIX shell script fragment that will be appended to the default
script executed as the ramdisk is booted (/init) script executed as the ramdisk is booted (/init)
Third party flavours Third party elements
-------------------- --------------------
Pending implementation. The idea is to have a search path for flavours. Pending implementation. The idea is to have a search path for elements.
Installation Installation
============ ============

View File

@ -46,17 +46,17 @@ while true ; do
*) echo "Internal error!" ; exit 1 ;; *) echo "Internal error!" ; exit 1 ;;
esac esac
done done
for arg do IMAGE_FLAVOUR="$IMAGE_FLAVOUR $arg" ; done for arg do IMAGE_ELEMENT="$IMAGE_ELEMENT $arg" ; done
source $_LIB/img-defaults source $_LIB/img-defaults
source $_LIB/common-functions source $_LIB/common-functions
source $_LIB/img-functions source $_LIB/img-functions
echo "Building flavours: $IMAGE_FLAVOUR" echo "Building elements: $IMAGE_ELEMENT"
echo "If prompted for sudo, install sudoers.d/img-build-sudoers into /etc/sudoers.d and restart the build." echo "If prompted for sudo, install sudoers.d/img-build-sudoers into /etc/sudoers.d and restart the build."
mkdir -p $IMG_PATH mkdir -p $IMG_PATH
# TODO: make a flavour. # TODO: make an element.
ensure_nbd ensure_nbd
mk_build_dir mk_build_dir

View File

@ -51,13 +51,13 @@ while true ; do
*) echo "Internal error!" ; exit 1 ;; *) echo "Internal error!" ; exit 1 ;;
esac esac
done done
for arg do RAMDISK_FLAVOUR="$RAMDISK_FLAVOUR $arg" ; done for arg do RAMDISK_ELEMENT="$RAMDISK_ELEMENT $arg" ; done
source $_LIB/ramdisk-defaults source $_LIB/ramdisk-defaults
source $_LIB/common-functions source $_LIB/common-functions
source $_LIB/ramdisk-functions source $_LIB/ramdisk-functions
echo "Building flavour(s): ${RAMDISK_FLAVOUR}" echo "Building element(s): ${RAMDISK_ELEMENT}"
echo "Discovering binary dependencies" echo "Discovering binary dependencies"
ensure_binaries ensure_binaries

View File

@ -0,0 +1,2 @@
A ramdisk that will expose the machine primary disk over iSCSI and reboot
once baremetal-deploy-helper signals it is finished.

View File

@ -1,5 +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 Forces a 16GB image to allow room for Swift, Cinder and instance
disk images. disk images.

View File

@ -0,0 +1,2 @@
A hardware test ramdisk - exercises the machine RAM and exercises the hard
disks

View File

@ -0,0 +1 @@
A ramdisk to report the hardware of a machine to an inventory service.

View File

@ -0,0 +1 @@
Force support for mellanox hardware

View File

@ -1,2 +0,0 @@
This flavour is for booting baremetal nodes.
It does some iSCSI setup and fetches a disk image

View File

@ -1,2 +0,0 @@
This flavour is intended to be used to test hardware.
It will exercise RAM and disks.

View File

@ -1 +0,0 @@
This flavour will examing the available hardware it boots on, and report it to an inventory service.

View File

@ -1 +0,0 @@
Flavour to force support for mellanox hardware

View File

@ -38,14 +38,14 @@ function save_image () {
function generate_hooks () { function generate_hooks () {
mkdir -p $TMP_HOOKS_PATH mkdir -p $TMP_HOOKS_PATH
for _FLAVOUR in $IMAGE_FLAVOUR ; do for _ELEMENT in $IMAGE_ELEMENT ; do
[ -d $FLAVOURS_DIR/$_FLAVOUR ] || die "The flavour does not exist." ; [ -d $ELEMENTS_DIR/$_ELEMENT ] || die "The element does not exist." ;
cp -t $TMP_HOOKS_PATH -a $FLAVOURS_DIR/$_FLAVOUR/* ; cp -t $TMP_HOOKS_PATH -a $ELEMENTS_DIR/$_ELEMENT/* ;
done done
} }
# Check that a real flavour has been chosen (prevents foot-guns) # Check that a real element has been chosen (prevents foot-guns)
function check_flavour () { function check_element () {
[ -d $TMP_HOOKS_PATH ] || generate_hooks [ -d $TMP_HOOKS_PATH ] || generate_hooks
} }

View File

@ -24,6 +24,6 @@ IMAGE_TYPE=${IMAGE_TYPE:-qcow2}
IMAGE_NAME=${IMAGE_NAME:-image} IMAGE_NAME=${IMAGE_NAME:-image}
export IMAGE_SIZE=${IMAGE_SIZE:-2} # N.B. This size is in GB export IMAGE_SIZE=${IMAGE_SIZE:-2} # N.B. This size is in GB
# Set via the CLI normally. # Set via the CLI normally.
# IMAGE_FLAVOUR= # IMAGE_ELEMENT=
IMG_PATH=~/.cache/image-create IMG_PATH=~/.cache/image-create
FLAVOURS_DIR=$(dirname $0)/../flavours ELEMENTS_DIR=$(dirname $0)/../elements

View File

@ -115,7 +115,7 @@ function run_in_target() {
# Helper function to run a directory of scripts inside the chroot # Helper function to run a directory of scripts inside the chroot
function run_d_in_target() { function run_d_in_target() {
check_flavour check_element
# If we can find a directory of hooks to run in the target filesystem, bind # If we can find a directory of hooks to run in the target filesystem, bind
# mount it into the target and then execute run-parts in a chroot # mount it into the target and then execute run-parts in a chroot
if [ -d ${TMP_HOOKS_PATH}/$1.d ] ; then if [ -d ${TMP_HOOKS_PATH}/$1.d ] ; then
@ -130,7 +130,7 @@ function run_d_in_target() {
# Run a directory of hooks outside the target. # Run a directory of hooks outside the target.
function run_d() { function run_d() {
check_flavour check_element
if [ -d ${TMP_HOOKS_PATH}/$1.d ] ; then if [ -d ${TMP_HOOKS_PATH}/$1.d ] ; then
run-parts ${TMP_HOOKS_PATH}/$1.d run-parts ${TMP_HOOKS_PATH}/$1.d
fi fi
@ -220,7 +220,7 @@ function do_pre_install () {
run_in_target apt-get -y update run_in_target apt-get -y update
run_in_target apt-get -y install python-software-properties run_in_target apt-get -y install python-software-properties
run_in_target add-apt-repository -y ppa:tripleo/demo run_in_target add-apt-repository -y ppa:tripleo/demo
# Uncomment to get the bleeding edge - this should be a flavour thing. # Uncomment to get the bleeding edge - this should be an element thing.
# run_in_target add-apt-repository -y ppa:tripleo/demo-staging # run_in_target add-apt-repository -y ppa:tripleo/demo-staging
# Run pre-install scripts. These do things that prepare the chroot for package installs # Run pre-install scripts. These do things that prepare the chroot for package installs
run_d_in_target pre-install run_d_in_target pre-install

View File

@ -4,4 +4,4 @@ MODULE_ROOT=${MODULE_ROOT:-""}
LIB_UDEV_ROOT=${LIB_UDEV_ROOT:-""} LIB_UDEV_ROOT=${LIB_UDEV_ROOT:-""}
BUSYBOX=${BUSYBOX:-$(which busybox)} BUSYBOX=${BUSYBOX:-$(which busybox)}
IMAGE_NAME=${IMAGE_NAME:-"ramdisk"} IMAGE_NAME=${IMAGE_NAME:-"ramdisk"}
FLAVOURS_DIR=$(dirname $0)/../flavours ELEMENTS_DIR=$(dirname $0)/../elements

View File

@ -13,8 +13,8 @@ function cleanup () {
function ensure_binaries() { function ensure_binaries() {
BINARY_DEPS="${BUSYBOX}" BINARY_DEPS="${BUSYBOX}"
for _FLVR in ${RAMDISK_FLAVOUR} ; do for _FLVR in ${RAMDISK_ELEMENT} ; do
_FILE="${FLAVOURS_DIR}/${_FLVR}/binary-deps" _FILE="${ELEMENTS_DIR}/${_FLVR}/binary-deps"
if [ -a $_FILE ]; then if [ -a $_FILE ]; then
for _LINE in $(cat $_FILE) ; do for _LINE in $(cat $_FILE) ; do
BINARY_DEPS="${BINARY_DEPS} $_LINE" BINARY_DEPS="${BINARY_DEPS} $_LINE"
@ -119,9 +119,9 @@ function populate_init () {
cp "$F" "$TMP_MOUNT_PATH" cp "$F" "$TMP_MOUNT_PATH"
done done
# Append /init with any flavour fragments that are present # Append /init with any element fragments that are present
for _FLVR in ${RAMDISK_FLAVOUR} ; do for _FLVR in ${RAMDISK_ELEMENT} ; do
_FILE="${FLAVOURS_DIR}/${_FLVR}/init" _FILE="${ELEMENTS_DIR}/${_FLVR}/init"
if [ -a $_FILE ]; then if [ -a $_FILE ]; then
cat >>$TMP_MOUNT_PATH/init <<EOF cat >>$TMP_MOUNT_PATH/init <<EOF
@ -143,8 +143,8 @@ function finalise_image () {
function populate_udev () { function populate_udev () {
echo "Installing udev rules" echo "Installing udev rules"
for _FLVR in ${RAMDISK_FLAVOUR} ; do for _FLVR in ${RAMDISK_ELEMENT} ; do
_DIR="${FLAVOURS_DIR}/${_FLVR}/udev" _DIR="${ELEMENTS_DIR}/${_FLVR}/udev"
if [ -d $_DIR ]; then if [ -d $_DIR ]; then
find $_DIR -type f -exec cp -v {} $TMP_MOUNT_PATH/lib/udev/rules.d/ \; find $_DIR -type f -exec cp -v {} $TMP_MOUNT_PATH/lib/udev/rules.d/ \;
fi fi