aboutsummaryrefslogtreecommitdiff
path: root/dev/heat/get-image.sh
diff options
context:
space:
mode:
authorSteven Dake <stdake@cisco.com>2015-10-07 23:18:40 -0700
committerSteven Dake <stdake@cisco.com>2015-10-07 23:47:00 -0700
commit3b92e8714fc9a2e10cdbd73e36c05c838ba55852 (patch)
treebb6fbc7be2f6bd8faf578b64454ba16272998392 /dev/heat/get-image.sh
parente4094152de209c1444b3ea26a4abcdf28e3d1fb2 (diff)
downloadkolla-3b92e8714fc9a2e10cdbd73e36c05c838ba55852.tar.gz
kolla-3b92e8714fc9a2e10cdbd73e36c05c838ba55852.zip
Move around the development environments
THe top level dev directory is now used to store the heat and vagrant development environments. backport: liberty TrivialFix Change-Id: Ib0922b90eacaa8518aee09cdeb46f4ac0437e015
Diffstat (limited to 'dev/heat/get-image.sh')
-rwxr-xr-xdev/heat/get-image.sh41
1 files changed, 41 insertions, 0 deletions
diff --git a/dev/heat/get-image.sh b/dev/heat/get-image.sh
new file mode 100755
index 000000000..21166301e
--- /dev/null
+++ b/dev/heat/get-image.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+# This script expects the following to be installed:
+# curl, libguestfs-tools-c
+
+IMAGE_URL=http://archive.fedoraproject.org/pub/fedora/linux/releases/21/Cloud/Images/x86_64
+IMAGE=Fedora-Cloud-Base-20141203-21.x86_64.qcow2
+TARGET_DIR=/var/lib/libvirt/images
+TARGET=fedora-21-x86_64
+export LIBGUESTFS_BACKEND=direct
+
+if ! [ -f "$IMAGE" ]; then
+ echo "Downloading $IMAGE"
+ curl -L -O $IMAGE_URL/$IMAGE
+fi
+
+echo "Copying $IMAGE to $TARGET"
+cp "$IMAGE" $TARGET_DIR/$TARGET
+
+
+TMPFILE=$(mktemp /tmp/kolla-ifcfg-eth1.XXXXXXXXXX)
+cat > $TMPFILE <<EOF
+DEVICE=eth1
+BOOTPROTO=none
+ONBOOT=yes
+DEFROUTE=no
+EOF
+
+
+virt-customize \
+ --add $TARGET_DIR/$TARGET \
+ --upload $TMPFILE:/etc/sysconfig/network-scripts/ifcfg-eth1
+
+# 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
+
+rm -f $TMPFILE
+
+echo "Finished building image:"
+ls -l $TARGET_DIR/$TARGET