QA:Testcase build an OpenStack guest image with Oz

From FedoraProject

(Difference between revisions)
Jump to: navigation, search
(point to the latest oz. The version in F17 currently (0.7.0) has issues)
m (Updated (i.e. simplified) setup instructions to reflect F16/F17 status)
(One intermediate revision by one user not shown)
Line 6: Line 6:
|setup=Install the oz image builder
|setup=Install the oz image builder
  $> sudo yum install oz
$> file=oz-0.8.0-1.fc15.noarch.rpm
  $> sudo yum install http://$host/repos/aeolus/oz/0.8.0/packages/fedora-15/x86_64/$file
Create a template definition file called <code>f16-jeos.tdl</code> containing:
Create a template definition file called <code>f16-jeos.tdl</code> containing:
Line 78: Line 76:
[[Category:OpenStack Test Cases]]
[[Category:OpenStack Test Cases]]
[[Category:Cloud SIG]]

Latest revision as of 14:17, 20 July 2012



Building an Image With Oz

oz is a tool for automatically installing guest OSs with only minimal up-front input from the user.


Install the oz image builder

$> sudo yum install oz

Create a template definition file called f16-jeos.tdl containing:

 <description>My Fedora 16 x86_64 template</description>
  <install type='url'>
   <command name='setup-rc-local'>
sed -i 's/rhgb quiet/console=ttyS0/' /boot/grub/grub.conf
cat >> /etc/rc.local &lt;&lt; EOF
if [ ! -d /root/.ssh ]; then
  mkdir -p /root/.ssh
  chmod 700 /root/.ssh
# Fetch public key using HTTP
while [ ! -f /root/.ssh/authorized_keys ]; do
    curl -f > /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"
        FAILED=\$((\$FAILED + 1))
        if [ \$FAILED -ge \$ATTEMPTS ]; then
            echo "Failed to retrieve AWS public key after \$FAILED attempts, quitting"
        echo "Could not retrieve AWS public key (attempt #\$FAILED/\$ATTEMPTS), retrying in 5 seconds..."
        sleep 5

How to test

Build the guest image

$> sudo oz-install -d4 -u f16-jeos.tdl

Register the image with nova

$> sudo nova-manage image image_register /var/lib/libvirt/images/fedora16_x86_64.dsk 'admin' f16-jeos

Expected Results

Verify that the f16-jeos image is registered with the Glance image registry

$> glance index