From f5c3bd5dadbbde791088714ac195908a9d422688 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Fri, 26 Sep 2014 13:46:18 +1000 Subject: [PATCH] Initial centos7 support for build-image.sh Add some filtering to 55-cache-devsatck-repos to handle centos7, which actually gets setup with a DISTRO_NAME of rhel7 in devstack Update the readme file to highlight the options for building other images. "DISTRO=centos7 ./tools/build-image.sh" creates a workable centos7 qcow image with this change and a d-i-b that includes Ie24033468b78587ea87188ee1b843b26895798ff Change-Id: Ida38cba0a303ab77432d5d354f1952e00ebfa00e --- nodepool/elements/README.rst | 12 +++++++++--- .../extra-data.d/55-cache-devstack-repos | 14 +++++++++++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/nodepool/elements/README.rst b/nodepool/elements/README.rst index cb98263bcc..72b809a7c2 100644 --- a/nodepool/elements/README.rst +++ b/nodepool/elements/README.rst @@ -12,7 +12,7 @@ Install the dependencies: :: - sudo apt-get install kpartx qemu-utils curl + sudo apt-get install kpartx qemu-utils curl python-yaml Install diskimage-builder: @@ -28,9 +28,15 @@ Building an image is simple, we have a script! :: - bash tools/build-image.sh + DISTRO="ubuntu" bash tools/build-image.sh -You should be left with a file called devstack-gate-precise.qcow2. +See the script for environment variables to set distribution, etc. +You should be left with a .qcow2 image file of your selected +distribution. + +It is a good idea to set ``TMP_DIR`` to somewhere with plenty of space +to avoid the disappointment of a full-disk mid-way through the script +run. Mounting the image ------------------ diff --git a/nodepool/elements/cache-devstack/extra-data.d/55-cache-devstack-repos b/nodepool/elements/cache-devstack/extra-data.d/55-cache-devstack-repos index bb2afee4de..4aaa85f4b0 100755 --- a/nodepool/elements/cache-devstack/extra-data.d/55-cache-devstack-repos +++ b/nodepool/elements/cache-devstack/extra-data.d/55-cache-devstack-repos @@ -20,8 +20,20 @@ import os import subprocess import sys +# this is a bit weird; we want to get the filter to use on the +# devstack lib/[apt|rpm] files to pre-install them. So we have to +# swizzle things around +RELEASE=None +if 'DIB_RELEASE' in os.environ: + RELEASE=os.environ['DIB_RELEASE'] +if 'DISTRO_NAME' in os.environ: + if os.environ['DISTRO_NAME'] == 'centos7': + # centos7 matches as rhel7 in devstack + RELEASE='rhel7' +if not RELEASE: + print "Can not determine RELEASE" + sys.exit(1) -RELEASE = os.environ['DIB_RELEASE'] TMP_MOUNT_PATH = os.environ['TMP_MOUNT_PATH'] TMP_HOOKS_PATH = os.environ['TMP_HOOKS_PATH']