Implements: Blueprint update-image-build-script

Previously, the image used for Kolla development
needed to be manually created. This patch adds a
script to automate a consistent, repeatable process
for creating an F21 image used for Kolla development.

Change-Id: Ibbe41ac6c6f1d2f2bdd62a48b05c096967c8324e
This commit is contained in:
Daneyon Hansen 2015-02-12 19:30:12 +00:00
parent 4855d96c32
commit fd6d4376b9
2 changed files with 41 additions and 0 deletions

3
.gitignore vendored
View File

@ -2,5 +2,8 @@
*~
[._]*.s[a-w][a-z]
# Any qcow images created from get-image script
*.qcow2
.tox/
.buildconf

38
devenv/get-image.sh Executable file
View File

@ -0,0 +1,38 @@
#!/bin/bash
# This script expects the following to be installed:
# curl, libguestfs-tools-c
IMAGE=Fedora-Cloud-Base-20141203-21.x86_64.qcow2
TARGET_DIR=/var/lib/libvirt/images
TARGET=fedora-21-x86_64
if ! [ -f "$IMAGE" ]; then
echo "Downloading $IMAGE"
curl -O http://archive.fedoraproject.org/pub/fedora/linux/releases/21/Cloud/Images/x86_64/$IMAGE
fi
echo "Copying $IMAGE to $TARGET"
cp "$IMAGE" $TARGET_DIR/$TARGET
PACKAGES="git,tcpdump"
virt-customize \
--add $TARGET_DIR/$TARGET \
--install $PACKAGES \
--update \
--install $PACKAGES \
--run-command "yum clean all" \
--run-command "cat > /etc/sysconfig/network-scripts/ifcfg-eth1 <<EOF
DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
DEFROUTE=no
EOF" \
# SELinux relabeling requires virt-customize to have networking disabled
# https://bugzilla.redhat.com/show_bug.cgi?id=1122907
virt-customize --add $TARGET_DIR/$TARGET --selinux-relabel --no-network
echo "Finished building image:"
ls -l $TARGET_DIR/$TARGET