Jump to: navigation, search

Ironic

Revision as of 22:17, 12 September 2013 by Nobodycam (talk | contribs) (Using Disk Image Builder)
Source code
Code review board
Bug tracker
Blueprints
Developer docs
Weekly meetings

Ironic: Bare Metal provisioning for OpenStack

Ironic is under rapid initial development, forked from Nova's Baremetal driver. If you're looking for something that works today, go there :)

If you'd like to join the development, start by reading the developer docs here, and then join us in the #openstack-ironic on irc.freenode.net!

Building Documentation Locally

If you want to build the ironic docs for yourself locally, follow these steps:

create a vm

 #using vagrant 1.2.2 with a virtualbox backend
 vagrant init precise32
 #enable networking with the host
   vi Vagrantfile
   add
     config.vm.network :forwarded_port, guest: 80, host: 4567
 vagrant up

shell into the vm

 vagrant ssh

install dependencies

 sudo apt-get update
 sudo apt-get install -y git apache2 python-pip python-dev swig libssl-dev python-pip libmysqlclient-dev libxml2-dev libxslt-dev libxslt1-dev python-mysqldb
 sudo pip install virtualenv setuptools-git flake8 tox
 sudo easy_install nose

get the ironic repo

 cd ~
 git clone git://github.com/openstack/ironic.git

create a file enabling ironic.localhost in apache

 sudo vi /etc/apache2/sites-enabled/100-ironic
 # contents
 <VirtualHost *:80>
     ServerName ironic.localhost
     DocumentRoot /opt/source/ironic/doc/build/html
   
         <Directory /opt/source/ironic/doc/build/html>
                 Options Indexes FollowSymLinks MultiViews
                 AllowOverride None
                 Order allow,deny
                 allow from all
         </Directory>
 </VirtualHost>
 # change the DocumentRoot and the Directory to point the the ironic repo, if you are using
 # vagrant and the ironic repo is the the vagrant user's home directory the code is fine

create a venv inside the ironic repo

 cd ironic
 tox -evenv -- echo 'done'

activate the newly created venv

 source .tox/venv/bin/activate

from inside the venv

 python setup.py build_sphinx
 # as I run this I get 20 warnings, ignore the warnings

exit the venv

 deactivate

restart apache

 sudo service apache2 restart

on your host:

 add ironic.localhost to /etc/hosts with:
 sudo sed -i 's/\(127.0.0.1\s*localhost\)/\1 ironic.localhost/' /etc/hosts

point your browser to http://ironic.localhost:4567

You should be reading your newly build documentation.

Try it on Devstack

To install Ironic using Devstack follow the following steps:

1. Obtain the latest copy of Devstack:

 git clone git://github.com/openstack-dev/devstack.git

2. Go to the Devstack source tree and create a localrc file with at least the following options:

 # Enable Ironic API and Ironic Conductor
 enable_service ir-api
 enable_service ir-cond
 
 # Enable Neutron which is required by Ironic and disable nova-network.
 disable_service n-net
 enable_service q-svc
 enable_service q-agt
 enable_service q-dhcp
 enable_service q-l3
 enable_service q-meta
 enable_service neutron
 
 # You can replace "password" with your own one.
 ADMIN_PASSWORD=password
 MYSQL_PASSWORD=password
 RABBIT_PASSWORD=password
 SERVICE_PASSWORD=password

3. Run installation of Devstack:

 ./stack.sh

4. Wait until everything gets installed.

5. Ironic API service is listening on http://YOUR_IP:6385

Using Disk Image Builder

In this section we will go over how to setup Ironic with in the tripleo enviroment.

The current Ironic element is intented to launch alongside the TripleO undercloud-vm.

If you have not used the DiskImage-Builder (DIB) tool before please read and familiarize your self with the TripleO story:

are some good starting points:



Please follow TripleO's devtest.md up to step #17. Use the following command to replace the orginal Step #18:

create-nodes $NODE_CPU $NODE_MEM $NODE_DISK $NODE_ARCH 2

NOTE: we are creating only 2 vm's instead of 3, as we will not be deployig the over cloud for our initial work.Wwe will create another vm for ironic to boot a little later on in this setup.

Then continue on to step #20 where we will change:

setup-baremetal $NODE_CPU $NODE_MEM $NODE_DISK $NODE_ARCH seed

to:

setup-baremetal $NODE_CPU $NODE_MEM $NODE_DISK $NODE_ARCH all

Note: This change will register both of the nodes we created with the seed-vm instead of just the first node.

Continue up to step #22. Add Ironic to the undercloud image. like this:

$TRIPLEO_ROOT/diskimage-builder/bin/disk-image-create ubuntu \
   -a $NODE_ARCH -o undercloud boot-stack nova-baremetal os-collect-config \
   stackuser ironic

NOTE: This will install Ironic on the undercloud vm. This is used to trigger database creation on the undercloud vm. After Step #23 run these commands o build and load your ironic image.

$TRIPLEO_ROOT/diskimage-builder/bin/disk-image-create ubuntu -a i386 -o ironic ironic stackuser
load-image ironic.qcow2

Note: ensure the images are loaded with the glance image-list command.

At this point we need to merge the Ironic template with the undercloud template. This will create a new template that will lunch both the undercloud and ironic images on the two nodes we created above.

To merge the two templates we can use TripleO's merge.py script:

python $TRIPLEO_ROOT/tripleo-heat-templates/merge.py $TRIPLEO_ROOT/tripleo-heat-templates/undercloud-vm.yaml  $TRIPLEO_ROOT/tripleo-heat-templates/ironic.yaml > UndercloudAndIronic.yaml

NOTE: this will create a merged yaml file in the current directory.

Now fire them up!

heat stack-create -f UndercloudAndIronic.yaml -P "PowerUserName=$(whoami);ServicePassword=$OS_PASSWORD;RabbitPassword=guest" undercloud

After HEAT has finished its magic nova list should show two nodes:

+----------------------+------------------------------------+--------+------------+-------------+--------------------+
| ID                   | Name                               | Status | Task State | Power State | Networks           |
+----------------------+------------------------------------+--------+------------+-------------+--------------------+
| <UUID>               | undercloud-Ironic-mgkl6levbfvv     | ACTIVE | None       | Running     | ctlplane=192.0.2.3 |
| <UUID>               | undercloud-notcompute-bo7jyyewi3on | ACTIVE | None       | Running     | ctlplane=192.0.2.2 |
+----------------------+------------------------------------+--------+------------+-------------+--------------------+

To login to the Ironic node with ssh use a command like this

ssh heat-admin@192.0.2.3

Note: 192.0.2.3 is retrieved from the above nova list example. We included the stackuser element when we built our ironic image if you have console access you may also login there with " stack " as both username and password. Both users, heat-admin and stack have sudo access.