Add heat-jeos TDL files and oz wrapper script
Import heat-jeos oz TDL files, and a utility script which wraps the commands required to process them. The heat-jeos.sh script is a simple (if not quite as fully featured) replacement for the heat-jeos tool, meaning we can deprecate it. fixes bug #1171602 Change-Id: I23416d1e3c7a5329c2076db6fbe6f51d44720766changes/28/27628/2
parent
de67cecf92
commit
f773a12e3b
|
@ -0,0 +1,37 @@
|
|||
<template>
|
||||
<name>CentOS-6.3-x86_64-cfntools</name>
|
||||
<os>
|
||||
<name>CentOS-6</name>
|
||||
<version>3</version>
|
||||
<arch>x86_64</arch>
|
||||
<install type='iso'>
|
||||
<iso>file:/var/lib/libvirt/images/CentOS-6.3-x86_64-bin-DVD1.iso</iso>
|
||||
</install>
|
||||
</os>
|
||||
<description>CentOS 6.3</description>
|
||||
<commands>
|
||||
<command name='network-config'>
|
||||
cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF
|
||||
DEVICE="eth0"
|
||||
BOOTPROTO=dhcp
|
||||
NM_CONTROLLED="yes"
|
||||
ONBOOT="yes"
|
||||
EOF
|
||||
</command>
|
||||
chmod +x /etc/rc.d/rc.local
|
||||
</command>
|
||||
<command name='packages'>
|
||||
yum -y update
|
||||
curl -O http://ftp.ps.pl/pub/Linux/fedora-epel/6/i386/epel-release-6-7.noarch.rpm
|
||||
rpm -Uvh epel-release-6-7.noarch.rpm
|
||||
yum -y install perl python python-setuptools cloud-init python-pip
|
||||
pip-python install argparse 'boto==2.5.2' heat-cfntools
|
||||
cfn-create-aws-symlinks --source /usr/bin
|
||||
rm -f epel-release-6-7.noarch.rpm
|
||||
</command>
|
||||
<command name='post-configuration'>
|
||||
chkconfig --level 345 sshd on
|
||||
rm -rf /etc/udev/rules.d/70-persistent-net.rules
|
||||
</command>
|
||||
</commands>
|
||||
</template>
|
|
@ -0,0 +1,23 @@
|
|||
<template>
|
||||
<name>F16-i386-cfntools</name>
|
||||
<os>
|
||||
<name>Fedora</name>
|
||||
<version>16</version>
|
||||
<arch>i386</arch>
|
||||
<install type='iso'>
|
||||
<iso>file:/var/lib/libvirt/images/Fedora-16-i386-DVD.iso</iso>
|
||||
</install>
|
||||
</os>
|
||||
<description>Fedora 16</description>
|
||||
<commands>
|
||||
<command name='packages'>
|
||||
yum -y update fedora-release
|
||||
yum -y install yum-plugin-fastestmirror cloud-init python-psutil python-pip
|
||||
yum -y update
|
||||
sed --in-place -e s/Type=oneshot/"Type=oneshot\nTimeoutSec=0"/ /lib/systemd/system/cloud-final.service
|
||||
pip-python install 'boto==2.5.2' heat-cfntools
|
||||
cfn-create-aws-symlinks --source /usr/bin
|
||||
|
||||
</command>
|
||||
</commands>
|
||||
</template>
|
|
@ -0,0 +1,45 @@
|
|||
<template>
|
||||
<name>F16-x86_64-cfntools-openshift</name>
|
||||
<os>
|
||||
<name>Fedora</name>
|
||||
<version>16</version>
|
||||
<arch>x86_64</arch>
|
||||
<install type='iso'>
|
||||
<iso>file:/var/lib/libvirt/images/Fedora-16-x86_64-DVD.iso</iso>
|
||||
</install>
|
||||
</os>
|
||||
<description>Fedora 16 base OpenShift Install</description>
|
||||
<commands>
|
||||
<command name='packages'>
|
||||
yum -y update fedora-release
|
||||
yum -y install yum-plugin-fastestmirror cloud-init python-psutil python-boto
|
||||
yum -y update
|
||||
sed --in-place -e s/Type=oneshot/"Type=oneshot\nTimeoutSec=0"/ /lib/systemd/system/cloud-final.service
|
||||
</command>
|
||||
<command name='cfn-perms'>
|
||||
chmod +x /opt/aws/bin/cfn-*
|
||||
</command>
|
||||
<command name='openshift_prereqs'>
|
||||
sed -i "s/SELINUX=enforcing/SELINUX=permissive/" /etc/selinux/config
|
||||
setenforce 0
|
||||
yum -y install ntp git vim emacs wget tig mock createrepo tito fedora-kickstarts livecd-tools ruby rubygems rubygem-rake java-1.6.0-openjdk jpackage-utils java-1.6.0-openjdk-devel
|
||||
</command>
|
||||
<command name='openshift_build'>
|
||||
useradd builder
|
||||
usermod -a -G mock builder
|
||||
su builder -c 'cd /home/builder ; git clone git://github.com/openshift/crankcase.git /home/builder/crankcase'
|
||||
echo 'Hacking Rakefile to work with notty'
|
||||
sed -i '/.*usermod.*/d' /home/builder/crankcase/build/Rakefile
|
||||
cd /home/builder/crankcase/build; rake build_setup
|
||||
cd /home/builder/crankcase/build ; rake build
|
||||
</command>
|
||||
</commands>
|
||||
<files>
|
||||
<file name='/opt/aws/bin/cfn-init' type='base64'></file>
|
||||
<file name='/opt/aws/bin/cfn-hup' type='base64'></file>
|
||||
<file name='/opt/aws/bin/cfn-signal' type='base64'></file>
|
||||
<file name='/opt/aws/bin/cfn_helper.py' type='base64'></file>
|
||||
<file name='/opt/aws/bin/cfn-get-metadata' type='base64'></file>
|
||||
<file name='/opt/aws/bin/cfn-push-stats' type='base64'></file>
|
||||
</files>
|
||||
</template>
|
|
@ -0,0 +1,23 @@
|
|||
<template>
|
||||
<name>F16-x86_64-cfntools</name>
|
||||
<os>
|
||||
<name>Fedora</name>
|
||||
<version>16</version>
|
||||
<arch>x86_64</arch>
|
||||
<install type='iso'>
|
||||
<iso>file:/var/lib/libvirt/images/Fedora-16-x86_64-DVD.iso</iso>
|
||||
</install>
|
||||
</os>
|
||||
<description>Fedora 16</description>
|
||||
<commands>
|
||||
<command name='packages'>
|
||||
yum -y update fedora-release
|
||||
yum -y install yum-plugin-fastestmirror cloud-init python-psutil python-pip
|
||||
yum -y update
|
||||
sed --in-place -e s/Type=oneshot/"Type=oneshot\nTimeoutSec=0"/ /lib/systemd/system/cloud-final.service
|
||||
pip-python install 'boto==2.5.2' heat-cfntools
|
||||
cfn-create-aws-symlinks --source /usr/bin
|
||||
|
||||
</command>
|
||||
</commands>
|
||||
</template>
|
|
@ -0,0 +1,23 @@
|
|||
<template>
|
||||
<name>F17-i386-cfntools</name>
|
||||
<os>
|
||||
<name>Fedora</name>
|
||||
<version>17</version>
|
||||
<arch>i386</arch>
|
||||
<install type='iso'>
|
||||
<iso>file:/var/lib/libvirt/images/Fedora-17-i386-DVD.iso</iso>
|
||||
</install>
|
||||
</os>
|
||||
<description>Fedora 17</description>
|
||||
<commands>
|
||||
<command name='packages'>
|
||||
yum -y update fedora-release
|
||||
yum -y install yum-plugin-fastestmirror cloud-init python-psutil python-pip
|
||||
yum -y update
|
||||
sed --in-place -e s/Type=oneshot/"Type=oneshot\nTimeoutSec=0"/ /lib/systemd/system/cloud-final.service
|
||||
pip-python install 'boto==2.5.2' heat-cfntools
|
||||
cfn-create-aws-symlinks --source /usr/bin
|
||||
|
||||
</command>
|
||||
</commands>
|
||||
</template>
|
|
@ -0,0 +1,23 @@
|
|||
<template>
|
||||
<name>F17-x86_64-cfntools</name>
|
||||
<os>
|
||||
<name>Fedora</name>
|
||||
<version>17</version>
|
||||
<arch>x86_64</arch>
|
||||
<install type='iso'>
|
||||
<iso>file:/var/lib/libvirt/images/Fedora-17-x86_64-DVD.iso</iso>
|
||||
</install>
|
||||
</os>
|
||||
<description>Fedora 17</description>
|
||||
<commands>
|
||||
<command name='packages'>
|
||||
yum -y update fedora-release
|
||||
yum -y install yum-plugin-fastestmirror cloud-init python-psutil python-pip
|
||||
yum -y update
|
||||
sed --in-place -e s/Type=oneshot/"Type=oneshot\nTimeoutSec=0"/ /lib/systemd/system/cloud-final.service
|
||||
pip-python install 'boto==2.5.2' heat-cfntools
|
||||
cfn-create-aws-symlinks --source /usr/bin
|
||||
|
||||
</command>
|
||||
</commands>
|
||||
</template>
|
|
@ -0,0 +1,23 @@
|
|||
<template>
|
||||
<name>F18-i386-cfntools</name>
|
||||
<os>
|
||||
<name>Fedora</name>
|
||||
<version>18</version>
|
||||
<arch>i386</arch>
|
||||
<install type='iso'>
|
||||
<iso>file:/var/lib/libvirt/images/Fedora-18-i386-DVD.iso</iso>
|
||||
</install>
|
||||
</os>
|
||||
<description>Fedora 18</description>
|
||||
<commands>
|
||||
<command name='packages'>
|
||||
yum -y update fedora-release
|
||||
yum -y install yum-plugin-fastestmirror cloud-init python-psutil python-pip python-boto
|
||||
yum -y update
|
||||
sed --in-place -e s/Type=oneshot/"Type=oneshot\nTimeoutSec=0"/ /lib/systemd/system/cloud-final.service
|
||||
pip-python install heat-cfntools
|
||||
cfn-create-aws-symlinks --source /usr/bin
|
||||
|
||||
</command>
|
||||
</commands>
|
||||
</template>
|
|
@ -0,0 +1,23 @@
|
|||
<template>
|
||||
<name>F18-x86_64-cfntools</name>
|
||||
<os>
|
||||
<name>Fedora</name>
|
||||
<version>18</version>
|
||||
<arch>x86_64</arch>
|
||||
<install type='iso'>
|
||||
<iso>file:/var/lib/libvirt/images/Fedora-18-x86_64-DVD.iso</iso>
|
||||
</install>
|
||||
</os>
|
||||
<description>Fedora 18</description>
|
||||
<commands>
|
||||
<command name='packages'>
|
||||
yum -y update fedora-release
|
||||
yum -y install yum-plugin-fastestmirror cloud-init python-psutil python-pip python-boto
|
||||
yum -y update
|
||||
sed --in-place -e s/Type=oneshot/"Type=oneshot\nTimeoutSec=0"/ /lib/systemd/system/cloud-final.service
|
||||
pip-python install heat-cfntools
|
||||
cfn-create-aws-symlinks --source /usr/bin
|
||||
|
||||
</command>
|
||||
</commands>
|
||||
</template>
|
|
@ -0,0 +1,23 @@
|
|||
<template>
|
||||
<name>U10-x86_64-cfntools</name>
|
||||
<os>
|
||||
<name>Ubuntu</name>
|
||||
<version>10.04</version>
|
||||
<arch>x86_64</arch>
|
||||
<install type='iso'>
|
||||
<iso>file:/var/lib/libvirt/images/ubuntu-10.04.4-server-amd64.iso</iso>
|
||||
</install>
|
||||
</os>
|
||||
<description>Ubuntu 10.04</description>
|
||||
<commands>
|
||||
<command name='commands'>
|
||||
apt-get -y update
|
||||
apt-get -y upgrade
|
||||
apt-get -y install python-argparse chkconfig cloud-init python-psutil python-pip
|
||||
apt-get -y remove python-boto
|
||||
|
||||
pip install 'boto==2.5.2' heat-cfntools
|
||||
cfn-create-aws-symlinks --source /usr/local/bin
|
||||
</command>
|
||||
</commands>
|
||||
</template>
|
|
@ -0,0 +1,23 @@
|
|||
<template>
|
||||
<name>U12-10-x86_64-cfntools</name>
|
||||
<os>
|
||||
<name>Ubuntu</name>
|
||||
<version>12.10</version>
|
||||
<arch>x86_64</arch>
|
||||
<install type='iso'>
|
||||
<iso>file:/var/lib/libvirt/images/ubuntu-12.10-server-amd64.iso</iso>
|
||||
</install>
|
||||
</os>
|
||||
<description>Ubuntu 12.10</description>
|
||||
<commands>
|
||||
<command name='commands'>
|
||||
apt-get -y update
|
||||
apt-get -y upgrade
|
||||
apt-get -y install python-argparse cloud-init python-psutil python-pip
|
||||
apt-get -y remove python-boto
|
||||
|
||||
pip install 'boto==2.5.2' heat-cfntools
|
||||
cfn-create-aws-symlinks --source /usr/local/bin
|
||||
</command>
|
||||
</commands>
|
||||
</template>
|
|
@ -0,0 +1,23 @@
|
|||
<template>
|
||||
<name>U12-10-i386-cfntools</name>
|
||||
<os>
|
||||
<name>Ubuntu</name>
|
||||
<version>12.10</version>
|
||||
<arch>i386</arch>
|
||||
<install type='iso'>
|
||||
<iso>file:/var/lib/libvirt/images/ubuntu-12.10-server-i386.iso</iso>
|
||||
</install>
|
||||
</os>
|
||||
<description>Ubuntu 12.10</description>
|
||||
<commands>
|
||||
<command name='commands'>
|
||||
apt-get -y update
|
||||
apt-get -y upgrade
|
||||
apt-get -y install python-argparse cloud-init python-psutil python-pip
|
||||
apt-get -y remove python-boto
|
||||
|
||||
pip install 'boto==2.5.2' heat-cfntools
|
||||
cfn-create-aws-symlinks --source /usr/local/bin
|
||||
</command>
|
||||
</commands>
|
||||
</template>
|
|
@ -0,0 +1,51 @@
|
|||
#!/bin/bash
|
||||
# Build a JEOS image using OZ
|
||||
|
||||
exit_usage(){
|
||||
echo "Error : $1"
|
||||
echo "Usage $0 <tdl file> <image name>"
|
||||
echo "Note tdl file must be a valid Oz TDL"
|
||||
echo "Note image name must match the name defined in the TDL"
|
||||
exit 1
|
||||
}
|
||||
|
||||
DISK_FORMAT="qcow2"
|
||||
LIBVIRT_IMGDIR="/var/lib/libvirt/images"
|
||||
DEBUG="-d 3"
|
||||
|
||||
if [ $# -ne 2 ]; then
|
||||
exit_usage "Insufficient arguments"
|
||||
fi
|
||||
TDLFILE=$1
|
||||
TDLNAME=$2
|
||||
LIBVIRT_XMLFILE="/tmp/${TDLNAME}_libvirtxml.$$"
|
||||
|
||||
# Sanity check user input
|
||||
if [ ! -s "${TDLFILE}" ]
|
||||
then
|
||||
exit_usage "${TDLFILE} does not exist or is empty"
|
||||
fi
|
||||
|
||||
if ! grep -q ${TDLNAME} ${TDLFILE}; then
|
||||
exit_usage "${TDLNAME} not defined in ${TDLFILE}"
|
||||
fi
|
||||
|
||||
if [ -e "${LIBVIRT_IMGDIR}/${TDLNAME}.dsk" ]; then
|
||||
exit_usage "${LIBVIRT_IMGDIR}/${TDLNAME}.dsk already exists, please remove then re-run"
|
||||
fi
|
||||
|
||||
oz-install -u ${DEBUG} ${TDLFILE} -x ${LIBVIRT_XMLFILE}
|
||||
|
||||
DSKFILE="${LIBVIRT_IMGDIR}/${TDLNAME}.dsk"
|
||||
FMTFILE="${LIBVIRT_IMGDIR}/${TDLNAME}.${DISK_FORMAT}"
|
||||
qemu-img convert -c -O ${DISK_FORMAT} ${DSKFILE} ${FMTFILE}
|
||||
|
||||
if [ -f ${FMTFILE} ]; then
|
||||
echo "Image ${FMTFILE} complete, now add image to glance, e.g:"
|
||||
GLANCECMD="glance add name=${TDLNAME} is_public=true disk_format=${DISK_FORMAT} container_format=bare"
|
||||
echo "${GLANCECMD} < ${FMTFILE}"
|
||||
else
|
||||
echo "Error creating image file ${FMTFILE}"
|
||||
fi
|
||||
|
||||
rm -f ${LIBVIRT_XMLFILE}
|
Loading…
Reference in New Issue