Add 32-bit tdls for Fedora 16,17 jeos (gold and cfntools)

fixes #26

Note that the templates have been adjusted and the naming of the 32-bit
versions to i386 instead of i686. The install really is i686, but making
the arch match what is listed in the install ISO seems less confusing.

Signed-off-by: Jeff Peeler <jpeeler@redhat.com>

Although the 32-bit version of Fedora (and others) ISOs are labeled with i386,
This commit is contained in:
Jeff Peeler 2012-04-11 20:56:45 -04:00
parent adf53e972a
commit 01488938cf
11 changed files with 294 additions and 47 deletions

View File

@ -17,6 +17,7 @@ import time
import json
import base64
import libxml2
import re
from urlparse import urlparse
# If ../heat/__init__.py exists, add ../ to Python search path, so that
@ -249,34 +250,35 @@ def jeos_create(options, arguments):
arch = arguments.pop(0)
instance_type = arguments.pop(0)
if not arch in ['x86_64', 'i686']:
arches = ('x86_64', 'i386', 'amd64')
arches_str = " | ".join(arches)
instance_types = ('gold', 'cfntools')
instances_str = " | ".join(instance_types)
if not arch in arches:
print 'arch %s not supported' % arch
print 'try: x86_64 or i686'
print 'try: heat jeos_create %s [ %s ]' % (distro, arches_str)
sys.exit(1)
if not instance_type in ('gold', 'cfntools'):
if not instance_type in instance_types:
print 'A JEOS instance type of %s not supported' % instance_type
print 'try: gold or cfntools'
print 'try: heat jeos_create %s %s [ %s ]' % (distro, arch, instances_str)
sys.exit(1)
iso = None
if distro == 'F16':
iso = '/var/lib/libvirt/images/Fedora-16-x86_64-DVD.iso'
elif distro == 'F15':
iso = '/var/lib/libvirt/images/Fedora-15-x86_64-DVD.iso'
elif distro == 'F17':
iso = '/var/lib/libvirt/images/Fedora-17-x86_64-DVD.iso'
fedora_match = re.match('F(1[6-7])', distro)
if fedora_match:
version = fedora_match.group(1)
iso = '/var/lib/libvirt/images/Fedora-%s-%s-DVD.iso' % (version, arch)
elif distro == 'U10':
iso = '/var/lib/libvirt/images/ubuntu-10.04.3-server-amd64.iso'
iso = '/var/lib/libvirt/images/ubuntu-10.04.3-server-%s.iso' % arch
else:
print 'distro %s not supported' % distro
print 'try: F15, F16, F17 or U10'
print 'try: F16, F17 or U10'
sys.exit(1)
if iso:
if not os.access(iso, os.R_OK):
print '*** %s does not exist.' % (iso)
sys.exit(1)
if not os.access(iso, os.R_OK):
print '*** %s does not exist.' % (iso)
sys.exit(1)
tdl_path = '%s%s-%s-%s-jeos.tdl' % (jeos_path, distro, arch, instance_type)

View File

@ -392,6 +392,7 @@ class Instance(Resource):
image_id = o.id
if image_id is None:
print "Image %s was not found in glance" % image_name
raise exception.ImageNotFound(image_name=image_name)
flavor_list = self.nova().flavors.list()

View File

@ -0,0 +1,61 @@
<template>
<name>F16-i386-cfntools-jeos</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>
<rootpw>password</rootpw>
</os>
<description>Fedora 16</description>
<commands>
<command name='commands'>
yum -y update --skip-broken;yum -y install cloud-init;cat >> /etc/rc.d/rc.local &lt;&lt; EOF;chmod +x /etc/rc.d/rc.local
#!/bin/bash
setenforce 0
while true; do
gdbus introspect --system --dest org.freedesktop.NetworkManager --object-path /org/freedesktop/NetworkManager/Devices/0 | grep "State = 100"
if [ \$? -eq 0 ]
then
break
fi
sleep 1
done
if [ ! -d /root/.ssh ]; then
mkdir -p /root/.ssh
chmod 700 /root/.ssh
fi
# Fetch public key using HTTP
ATTEMPTS=10
while [ ! -f /root/.ssh/authorized_keys ]; do
curl -f http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key > /tmp/aws-key 2>/dev/null
if [ \$? -eq 0 ]; then
cat /tmp/aws-key >> /root/.ssh/authorized_keys
chmod 0600 /root/.ssh/authorized_keys
restorecon /root/.ssh/authorized_keys
rm -f /tmp/aws-key
echo "Successfully retrieved AWS public key from instance metadata"
else
FAILED=\$((\$FAILED + 1))
if [ \$FAILED -ge \$ATTEMPTS ]; then
echo "Failed to retrieve AWS public key after \$FAILED attempts, quitting"
break
fi
echo "Could not retrieve AWS public key (attempt #\$FAILED/\$ATTEMPTS), retrying in 5 seconds..."
sleep 5
fi
done
chmod +x /opt/aws/bin/cfn-*
EOF
</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>
</files>
</template>

View File

@ -0,0 +1,61 @@
<template>
<name>F16-i386-gold-jeos</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>
<rootpw>password</rootpw>
</os>
<description>Fedora 16</description>
<commands>
<command name='commands'>
rm -f /etc/yum.repos.d/fedora-updates*;yum -y install cloud-init;cat >> /etc/rc.d/rc.local &lt;&lt; EOF;chmod +x /etc/rc.d/rc.local
#!/bin/bash
setenforce 0
while true; do
gdbus introspect --system --dest org.freedesktop.NetworkManager --object-path /org/freedesktop/NetworkManager/Devices/0 | grep "State = 100"
if [ \$? -eq 0 ]
then
break
fi
sleep 1
done
if [ ! -d /root/.ssh ]; then
mkdir -p /root/.ssh
chmod 700 /root/.ssh
fi
# Fetch public key using HTTP
ATTEMPTS=10
while [ ! -f /root/.ssh/authorized_keys ]; do
curl -f http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key > /tmp/aws-key 2>/dev/null
if [ \$? -eq 0 ]; then
cat /tmp/aws-key >> /root/.ssh/authorized_keys
chmod 0600 /root/.ssh/authorized_keys
restorecon /root/.ssh/authorized_keys
rm -f /tmp/aws-key
echo "Successfully retrieved AWS public key from instance metadata"
else
FAILED=\$((\$FAILED + 1))
if [ \$FAILED -ge \$ATTEMPTS ]; then
echo "Failed to retrieve AWS public key after \$FAILED attempts, quitting"
break
fi
echo "Could not retrieve AWS public key (attempt #\$FAILED/\$ATTEMPTS), retrying in 5 seconds..."
sleep 5
fi
done
while [ ! -f /var/lib/cloud/instance/user-data.txt ]; do
sleep 1
done
base64 -d /var/lib/cloud/instance/user-data.txt > /tmp/startup
chmod +x /tmp/startup
/tmp/startup
EOF
</command>
</commands>
</template>

View File

@ -0,0 +1,61 @@
<template>
<name>F17-i386-cfntools-jeos</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>
<rootpw>password</rootpw>
</os>
<description>Fedora 17</description>
<commands>
<command name='commands'>
yum -y update --skip-broken;yum -y install cloud-init;cat >> /etc/rc.d/rc.local &lt;&lt; EOF;chmod +x /etc/rc.d/rc.local
#!/bin/bash
setenforce 0
while true; do
gdbus introspect --system --dest org.freedesktop.NetworkManager --object-path /org/freedesktop/NetworkManager/Devices/0 | grep "State = 100"
if [ \$? -eq 0 ]
then
break
fi
sleep 1
done
if [ ! -d /root/.ssh ]; then
mkdir -p /root/.ssh
chmod 700 /root/.ssh
fi
# Fetch public key using HTTP
ATTEMPTS=10
while [ ! -f /root/.ssh/authorized_keys ]; do
curl -f http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key > /tmp/aws-key 2>/dev/null
if [ \$? -eq 0 ]; then
cat /tmp/aws-key >> /root/.ssh/authorized_keys
chmod 0600 /root/.ssh/authorized_keys
restorecon /root/.ssh/authorized_keys
rm -f /tmp/aws-key
echo "Successfully retrieved AWS public key from instance metadata"
else
FAILED=\$((\$FAILED + 1))
if [ \$FAILED -ge \$ATTEMPTS ]; then
echo "Failed to retrieve AWS public key after \$FAILED attempts, quitting"
break
fi
echo "Could not retrieve AWS public key (attempt #\$FAILED/\$ATTEMPTS), retrying in 5 seconds..."
sleep 5
fi
done
chmod +x /opt/aws/bin/cfn-*
EOF
</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>
</files>
</template>

View File

@ -0,0 +1,61 @@
<template>
<name>F17-i386-gold-jeos</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>
<rootpw>password</rootpw>
</os>
<description>Fedora 17</description>
<commands>
<command name='commands'>
rm -f /etc/yum.repos.d/fedora-updates*;yum -y install cloud-init;cat >> /etc/rc.d/rc.local &lt;&lt; EOF;chmod +x /etc/rc.d/rc.local
#!/bin/bash
setenforce 0
while true; do
gdbus introspect --system --dest org.freedesktop.NetworkManager --object-path /org/freedesktop/NetworkManager/Devices/0 | grep "State = 100"
if [ \$? -eq 0 ]
then
break
fi
sleep 1
done
if [ ! -d /root/.ssh ]; then
mkdir -p /root/.ssh
chmod 700 /root/.ssh
fi
# Fetch public key using HTTP
ATTEMPTS=10
while [ ! -f /root/.ssh/authorized_keys ]; do
curl -f http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key > /tmp/aws-key 2>/dev/null
if [ \$? -eq 0 ]; then
cat /tmp/aws-key >> /root/.ssh/authorized_keys
chmod 0600 /root/.ssh/authorized_keys
restorecon /root/.ssh/authorized_keys
rm -f /tmp/aws-key
echo "Successfully retrieved AWS public key from instance metadata"
else
FAILED=\$((\$FAILED + 1))
if [ \$FAILED -ge \$ATTEMPTS ]; then
echo "Failed to retrieve AWS public key after \$FAILED attempts, quitting"
break
fi
echo "Could not retrieve AWS public key (attempt #\$FAILED/\$ATTEMPTS), retrying in 5 seconds..."
sleep 5
fi
done
while [ ! -f /var/lib/cloud/instance/user-data.txt ]; do
sleep 1
done
base64 -d /var/lib/cloud/instance/user-data.txt > /tmp/startup
chmod +x /tmp/startup
/tmp/startup
EOF
</command>
</commands>
</template>

View File

@ -82,12 +82,12 @@
"cc1.4xlarge" : { "Arch" : "64" }
},
"DistroArch2AMI": {
"F16" : { "32" : "F16-i686", "64" : "F16-x86_64-gold" },
"F17" : { "32" : "F17-i686", "64" : "F17-x86_64-gold" },
"U10" : { "32" : "U10-i686", "64" : "U10-x86_64-gold" },
"RHEL-6.1" : { "32" : "rhel61-i686", "64" : "rhel61-x86_64-gold" },
"RHEL-6.2" : { "32" : "rhel62-i686", "64" : "rhel62-x86_64-gold" },
"RHEL-6.3" : { "32" : "rhel63-i686", "64" : "rhel63-x86_64-gold" }
"F16" : { "32" : "F16-i386-gold", "64" : "F16-x86_64-gold" },
"F17" : { "32" : "F17-i386-gold", "64" : "F17-x86_64-gold" },
"U10" : { "32" : "U10-i386-gold", "64" : "U10-x86_64-gold" },
"RHEL-6.1" : { "32" : "rhel61-i386-gold", "64" : "rhel61-x86_64-gold" },
"RHEL-6.2" : { "32" : "rhel62-i386-gold", "64" : "rhel62-x86_64-gold" },
"RHEL-6.3" : { "32" : "rhel63-i386-gold", "64" : "rhel63-x86_64-gold" }
}
},

View File

@ -49,12 +49,12 @@
"cc1.4xlarge" : { "Arch" : "64" }
},
"DistroArch2AMI": {
"F16" : { "32" : "F16-i686", "64" : "F16-x86_64-gold" },
"F17" : { "32" : "F17-i686", "64" : "F17-x86_64-gold" },
"U10" : { "32" : "U10-i686", "64" : "U10-x86_64-gold" },
"RHEL-6.1" : { "32" : "rhel61-i686", "64" : "rhel61-x86_64-gold" },
"RHEL-6.2" : { "32" : "rhel62-i686", "64" : "rhel62-x86_64-gold" },
"RHEL-6.3" : { "32" : "rhel63-i686", "64" : "rhel63-x86_64-gold" }
"F16" : { "32" : "F16-i386-gold", "64" : "F16-x86_64-gold" },
"F17" : { "32" : "F17-i386-gold", "64" : "F17-x86_64-gold" },
"U10" : { "32" : "U10-i386-gold", "64" : "U10-x86_64-gold" },
"RHEL-6.1" : { "32" : "rhel61-i386-gold", "64" : "rhel61-x86_64-gold" },
"RHEL-6.2" : { "32" : "rhel62-i386-gold", "64" : "rhel62-x86_64-gold" },
"RHEL-6.3" : { "32" : "rhel63-i386-gold", "64" : "rhel63-x86_64-gold" }
}
},

View File

@ -82,12 +82,12 @@
"cc1.4xlarge" : { "Arch" : "64" }
},
"DistroArch2AMI": {
"F16" : { "32" : "F16-i686", "64" : "F16-x86_64-gold" },
"F17" : { "32" : "F17-i686", "64" : "F17-x86_64-gold" },
"U10" : { "32" : "U10-i686", "64" : "U10-x86_64-gold" },
"RHEL-6.1" : { "32" : "rhel61-i686", "64" : "rhel61-x86_64-gold" },
"RHEL-6.2" : { "32" : "rhel62-i686", "64" : "rhel62-x86_64-gold" },
"RHEL-6.3" : { "32" : "rhel63-i686", "64" : "rhel63-x86_64-gold" }
"F16" : { "32" : "F16-i386-gold", "64" : "F16-x86_64-gold" },
"F17" : { "32" : "F17-i386-gold", "64" : "F17-x86_64-gold" },
"U10" : { "32" : "U10-i386-gold", "64" : "U10-x86_64-gold" },
"RHEL-6.1" : { "32" : "rhel61-i386-gold", "64" : "rhel61-x86_64-gold" },
"RHEL-6.2" : { "32" : "rhel62-i386-gold", "64" : "rhel62-x86_64-gold" },
"RHEL-6.3" : { "32" : "rhel63-i386-gold", "64" : "rhel63-x86_64-gold" }
}
},

View File

@ -49,12 +49,12 @@
"cc1.4xlarge" : { "Arch" : "64" }
},
"DistroArch2AMI": {
"F16" : { "32" : "F16-i686", "64" : "F16-x86_64-gold" },
"F17" : { "32" : "F17-i686", "64" : "F17-x86_64-gold" },
"U10" : { "32" : "U10-i686", "64" : "U10-x86_64-gold" },
"RHEL-6.1" : { "32" : "rhel61-i686", "64" : "rhel61-x86_64-gold" },
"RHEL-6.2" : { "32" : "rhel62-i686", "64" : "rhel62-x86_64-gold" },
"RHEL-6.3" : { "32" : "rhel63-i686", "64" : "rhel63-x86_64-gold" }
"F16" : { "32" : "F16-i386-gold", "64" : "F16-x86_64-gold" },
"F17" : { "32" : "F17-i386-gold", "64" : "F17-x86_64-gold" },
"U10" : { "32" : "U10-i386-gold", "64" : "U10-x86_64-gold" },
"RHEL-6.1" : { "32" : "rhel61-i386-gold", "64" : "rhel61-x86_64-gold" },
"RHEL-6.2" : { "32" : "rhel62-i386-gold", "64" : "rhel62-x86_64-gold" },
"RHEL-6.3" : { "32" : "rhel63-i386-gold", "64" : "rhel63-x86_64-gold" }
}
},

View File

@ -82,12 +82,12 @@
"cc1.4xlarge" : { "Arch" : "64" }
},
"DistroArch2AMI": {
"F16" : { "32" : "F16-i686", "64" : "F16-x86_64-cfntools" },
"F17" : { "32" : "F17-i686", "64" : "F17-x86_64-cfntools" },
"U10" : { "32" : "U10-i686", "64" : "U10-x86_64-cfntools" },
"RHEL-6.1" : { "32" : "rhel61-i686", "64" : "rhel61-x86_64-cfntools" },
"RHEL-6.2" : { "32" : "rhel62-i686", "64" : "rhel62-x86_64-cfntools" },
"RHEL-6.3" : { "32" : "rhel63-i686", "64" : "rhel63-x86_64-cfntools" }
"F16" : { "32" : "F16-i386-cfntools", "64" : "F16-x86_64-cfntools" },
"F17" : { "32" : "F17-i386-cfntools", "64" : "F17-x86_64-cfntools" },
"U10" : { "32" : "U10-i386-cfntools", "64" : "U10-x86_64-cfntools" },
"RHEL-6.1" : { "32" : "rhel61-i386-cfntools", "64" : "rhel61-x86_64-cfntools" },
"RHEL-6.2" : { "32" : "rhel62-i386-cfntools", "64" : "rhel62-x86_64-cfntools" },
"RHEL-6.3" : { "32" : "rhel63-i386-cfntools", "64" : "rhel63-x86_64-cfntools" }
}
},