Jump to: navigation, search

Difference between revisions of "Ironic"

(Using Disk Image Builder)
(Using Disk Image Builder)
Line 128: Line 128:
 
: '''Note''': TripleO heat templates are under rapid development and may invalidate this walk thru.
 
: '''Note''': TripleO heat templates are under rapid development and may invalidate this walk thru.
 
:: Element and Ironic yaml used in this walk may be found [https://github.com/NoBodyCam/ironic-element HERE].
 
:: Element and Ironic yaml used in this walk may be found [https://github.com/NoBodyCam/ironic-element HERE].
 
+
<br />
If you are not familiar with TripleO and / or have not used the DiskImage-Builder (DIB) tool before, please read and familiarize yourself with the TripleO story. These are some good starting points:
+
If not familiar with TripleO and / or have not used the DiskImage-Builder (DIB) tool before, please read and familiarize yourself with the TripleO story. These are some good starting points:
 
:* [https://github.com/openstack/tripleo-incubator/blob/master/README.md TripleO-ReadMe]
 
:* [https://github.com/openstack/tripleo-incubator/blob/master/README.md TripleO-ReadMe]
:* [https://github.com/openstack/tripleo-incubator/blob/master/Deploying.md Deploying-Doc]
+
:* [http://docs.openstack.org/developer/tripleo-incubator/deploying.html Deploying-Doc]
:* [https://github.com/openstack/tripleo-incubator/blob/master/devtest.md Devtest-Doc]
+
:* [http://docs.openstack.org/developer/tripleo-incubator/devtest.html Devtest-Doc]
 
 
: '''Note''': if you are using a fresh install for your enviroment, please run the "install-dependencies" script called for in [https://github.com/openstack/tripleo-incubator/blob/master/devtest.md Devtest-Doc], step #10 first. To do this, you will need to "apt-get install git" and "git clone https://github.com/openstack/tripleo-incubator.git".
 
 
 
  
Please follow TripleO's [https://github.com/openstack/tripleo-incubator/blob/master/devtest.md Devtest-Doc] up to step 24 ("Create your undercloud image").  
+
Please follow TripleO's [http://docs.openstack.org/developer/tripleo-incubator/devtest.html Devtest-Doc] up to the [http://docs.openstack.org/developer/tripleo-incubator/devtest_undercloud.html devtest_undercloud] section.
 
+
<br />
In order to add Ironic to the undercloud image, you will need the element and Ironic yaml from [https://github.com/NoBodyCam/ironic-element HERE]:
+
In order to add Ironic to the undercloud image, you will need the Ironic element and Ironic yaml from [https://github.com/NoBodyCam/ironic-element HERE]:<br />
 +
First clone the element.
 
  cd $TRIPLEO_ROOT/tripleo-image-elements/elements
 
  cd $TRIPLEO_ROOT/tripleo-image-elements/elements
 
  git clone https://github.com/NoBodyCam/ironic-element ironic
 
  git clone https://github.com/NoBodyCam/ironic-element ironic
 +
Copy the yaml file out of element we'll merge it later.
 
  cd ironic/yaml
 
  cd ironic/yaml
 
  cp ironic.yaml $TRIPLEO_ROOT/tripleo-heat-templates
 
  cp ironic.yaml $TRIPLEO_ROOT/tripleo-heat-templates
  
Add Ironic to the undercloud image, like this:
+
replace the command in step #1 of [http://docs.openstack.org/developer/tripleo-incubator/devtest_undercloud.html devtest_undercloud] with:
 
  $TRIPLEO_ROOT/diskimage-builder/bin/disk-image-create $NODE_DIST \
 
  $TRIPLEO_ROOT/diskimage-builder/bin/disk-image-create $NODE_DIST \
 
     -a $NODE_ARCH -o $TRIPLEO_ROOT/undercloud \
 
     -a $NODE_ARCH -o $TRIPLEO_ROOT/undercloud \
 
     boot-stack nova-baremetal os-collect-config stackuser $DHCP_DRIVER ironic
 
     boot-stack nova-baremetal os-collect-config stackuser $DHCP_DRIVER ironic
  
: '''Note''': This will install Ironic on the undercloud image. It will configure ironic.conf to use the undercloud's services. At this point it will NOT configure the undercloud to use Ironic's services.
+
: '''Note''': This will install Ironic and the Ironic command line client on the undercloud image. It will configure ironic.conf to use the undercloud's services. At this point it will NOT configure the undercloud to use Ironic's services.
  
Load the undercloud image containing Ironic you created above into glance:
+
In step #2 we load the undercloud image containing Ironic you created above into glance:
 
  load-image $TRIPLEO_ROOT/undercloud.qcow2
 
  load-image $TRIPLEO_ROOT/undercloud.qcow2
  
At this point we need to merge the Ironic template with the undercloud template. To merge the two templates we can use TripleO's merge.py script.
+
Before step #3, we need to merge the Ironic template with the undercloud template. To merge the two templates use TripleO's merge.py script.
However, before we can merge the two templates we will need to add a [http://i.qkme.me/3obagm.jpg ''hack''] into TripleO's undercloud-vm.yaml file.
+
However, before the two templates can be merged, The TripleO's undercloud-vm.yaml file will need to be [http://i.qkme.me/3obagm.jpg ''hacked''].
 
  sed -i 's/OpenStack::Heat::Stack: {}/OpenStack::Role: notcomputeConfig\n      OpenStack::Heat::Stack: {}/' $TRIPLEO_ROOT/tripleo-heat-templates/undercloud-vm.yaml
 
  sed -i 's/OpenStack::Heat::Stack: {}/OpenStack::Role: notcomputeConfig\n      OpenStack::Heat::Stack: {}/' $TRIPLEO_ROOT/tripleo-heat-templates/undercloud-vm.yaml
 
:'''Note''': TripleO is working hard to define a proper procedure for this.
 
:'''Note''': TripleO is working hard to define a proper procedure for this.
  
 +
Merge the Ironic and undercloud yaml files
 
  python $TRIPLEO_ROOT/tripleo-heat-templates/merge.py $TRIPLEO_ROOT/tripleo-heat-templates/undercloud-vm.yaml  $TRIPLEO_ROOT/tripleo-heat-templates/ironic.yaml > $TRIPLEO_ROOT/UndercloudAndIronic.yaml
 
  python $TRIPLEO_ROOT/tripleo-heat-templates/merge.py $TRIPLEO_ROOT/tripleo-heat-templates/undercloud-vm.yaml  $TRIPLEO_ROOT/tripleo-heat-templates/ironic.yaml > $TRIPLEO_ROOT/UndercloudAndIronic.yaml
: '''Note''': this will create a merged yaml file in the $TRIPLEO_ROOT directory.
+
: '''Note''': this will create the UndercloudAndIronic.yaml file in the $TRIPLEO_ROOT directory.
  
We will need to create the required passwords for the undercloud.
+
Step #3 of the [http://docs.openstack.org/developer/tripleo-incubator/devtest_undercloud.html devtest_undercloud-walkthru] creates the required passwords for the undercloud.
  export UNDERCLOUD_ADMIN_TOKEN=$(os-make-password)
+
  setup-passwords
  export UNDERCLOUD_ADMIN_PASSWORD=$(os-make-password)
+
  source tripleo-passwords
export UNDERCLOUD_GLANCE_PASSWORD=$(os-make-password)
 
export UNDERCLOUD_HEAT_PASSWORD=$(os-make-password)
 
export UNDERCLOUD_NEUTRON_PASSWORD=$(os-make-password)
 
export UNDERCLOUD_NOVA_PASSWORD=$(os-make-password)
 
  
Now spin up the undercloud!
+
Use the command below in place of [http://docs.openstack.org/developer/tripleo-incubator/devtest_undercloud.html devtest_undercloud-walkthru's] step #4 to spin up the undercloud!
  heat stack-create -f $TRIPLEO_ROOT/UndercloudAndIronic.yaml \
+
if [ "$DHCP_DRIVER" != "bm-dnsmasq" ]; then
    -P "PowerUserName=$(whoami);AdminToken=${UNDERCLOUD_ADMIN_TOKEN};AdminPassword=${UNDERCLOUD_ADMIN_PASSWORD};GlancePassword=${UNDERCLOUD_GLANCE_PASSWORD};HeatPassword=${UNDERCLOUD_HEAT_PASSWORD};NeutronPassword=${UNDERCLOUD_NEUTRON_PASSWORD};NovaPassword=${UNDERCLOUD_NOVA_PASSWORD};BaremetalArch=${NODE_ARCH}" \
+
    UNDERCLOUD_NATIVE_PXE=""
    undercloud
+
else
 +
    UNDERCLOUD_NATIVE_PXE=";NeutronNativePXE=True"
 +
fi
 +
 +
  heat stack-create '''-f $TRIPLEO_ROOT/UndercloudAndIronic.yaml''' \
 +
  -P "PowerUserName=$(whoami);\
 +
AdminToken=${UNDERCLOUD_ADMIN_TOKEN};\
 +
AdminPassword=${UNDERCLOUD_ADMIN_PASSWORD};\
 +
GlancePassword=${UNDERCLOUD_GLANCE_PASSWORD};\
 +
HeatPassword=${UNDERCLOUD_HEAT_PASSWORD};\
 +
NeutronPassword=${UNDERCLOUD_NEUTRON_PASSWORD};\
 +
NovaPassword=${UNDERCLOUD_NOVA_PASSWORD};\
 +
BaremetalArch=${NODE_ARCH}$UNDERCLOUD_NATIVE_PXE" \
 +
undercloud
 +
Contine to follow [http://docs.openstack.org/developer/tripleo-incubator/devtest_undercloud.html devtest_undercloud-walkthru's] up through step #8.
  
 +
After step #8, register the Ironic service with keystone.
 +
export UNDERCLOUD_IRONIC_PASSWORD=$(os-make-password)
 +
PASSWORD=$UNDERCLOUD_IRONIC_PASSWORD register-endpoint -r "regionOne" -d "Ironic Service" ironic baremetal http://$UNDERCLOUD_IP:6385
  
After HEAT has finished its magic, "nova list" should show something like this:
+
:'''Note''': in [http://docs.openstack.org/developer/tripleo-incubator/devtest_undercloud.html devtest_undercloud-walkthru's] step #9 nodes are registered to the underclouds nova-baremetal and not Ironic. See the Ironic command line client docs for examples on how to register nodes with Ironic.
 +
Be sure to run [http://docs.openstack.org/developer/tripleo-incubator/devtest_undercloud.html devtest_undercloud-walkthru's] step #10.
 +
<br />
 +
Once HEAT has finished its magic, "nova list" should show something like this:
 
  +----------------------+------------------------------------+--------+------------+-------------+--------------------+
 
  +----------------------+------------------------------------+--------+------------+-------------+--------------------+
 
  | ID                  | Name                              | Status | Task State | Power State | Networks          |
 
  | ID                  | Name                              | Status | Task State | Power State | Networks          |
Line 183: Line 199:
 
  | <UUID>              | undercloud-notcompute-bo7jyyewi3on | ACTIVE | None      | Running    | ctlplane=192.0.2.2 |
 
  | <UUID>              | undercloud-notcompute-bo7jyyewi3on | ACTIVE | None      | Running    | ctlplane=192.0.2.2 |
 
  +----------------------+------------------------------------+--------+------------+-------------+--------------------+
 
  +----------------------+------------------------------------+--------+------------+-------------+--------------------+
 
+
this will be the Ironic node.
 +
<br />
 
To login to the undercloud node with ssh, use a command like this
 
To login to the undercloud node with ssh, use a command like this
  ssh heat-admin@192.0.2.2
+
  ssh heat-admin@$UNDERCLOUD_IP
: '''Note''': 192.0.2.2 is retrieved from the above nova list example.
+
:'''Note''': We included the stackuser element when we built our image so if you have console access you may also login on the console with " stack " as both username and password. Both users, "heat-admin" and "stack", have full sudo access.
We included the stackuser element when we built our image so if you have console access you may also login on the console with " stack " as both username and password. Both users, "heat-admin" and "stack", have full sudo access.
 
  
Setup keystone on the undercloud.
 
: '''Note''': we are skipping TripleO's  "setup-baremetal $NODE_CPU $NODE_MEM $NODE_DISK $NODE_ARCH undercloud" step, as this would register the vm with nova and not ironic.
 
export UNDERCLOUD_IP=$(nova list | grep ctlplane | sed  -e "s/.*=\\([0-9.]*\\).*/\1/")
 
source $TRIPLEO_ROOT/tripleo-incubator/undercloudrc
 
init-keystone -p $UNDERCLOUD_ADMIN_PASSWORD $UNDERCLOUD_ADMIN_TOKEN $UNDERCLOUD_IP admin@example.com heat-admin@$UNDERCLOUD_IP
 
setup-endpoints $UNDERCLOUD_IP --glance-password $UNDERCLOUD_GLANCE_PASSWORD --heat-password $UNDERCLOUD_HEAT_PASSWORD --neutron-password  $UNDERCLOUD_NEUTRON_PASSWORD --nova-password $UNDERCLOUD_NOVA_PASSWORD
 
PASSWORD=$UNDERCLOUD_IRONIC_PASSWORD register-endpoint -r "regionOne" -d "Ironic Service" ironic baremetal http://$UNDERCLOUD_IP:6385
 
  
 
Test it.
 
Test it.
  ssh heat-admin@192.0.2.2
+
  ssh heat-admin@$UNDERCLOUD_IP
 
  sudo su -
 
  sudo su -
 
  source stackrc
 
  source stackrc
 
  ironic chassis-add --description MyFirstTestChassis
 
  ironic chassis-add --description MyFirstTestChassis
 
  ironic chassis-list
 
  ironic chassis-list

Revision as of 22:09, 3 October 2013

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-dev swig libssl-dev python-pip libmysqlclient-dev libxml2-dev libxslt-dev libxslt1-dev python-mysqldb libpq-dev
 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 set up Ironic within the TripleO enviroment.

Note: TripleO heat templates are under rapid development and may invalidate this walk thru.
Element and Ironic yaml used in this walk may be found HERE.


If not familiar with TripleO and / or have not used the DiskImage-Builder (DIB) tool before, please read and familiarize yourself with the TripleO story. These are some good starting points:

Please follow TripleO's Devtest-Doc up to the devtest_undercloud section.
In order to add Ironic to the undercloud image, you will need the Ironic element and Ironic yaml from HERE:
First clone the element.

cd $TRIPLEO_ROOT/tripleo-image-elements/elements
git clone https://github.com/NoBodyCam/ironic-element ironic

Copy the yaml file out of element we'll merge it later.

cd ironic/yaml
cp ironic.yaml $TRIPLEO_ROOT/tripleo-heat-templates

replace the command in step #1 of devtest_undercloud with:

$TRIPLEO_ROOT/diskimage-builder/bin/disk-image-create $NODE_DIST \
   -a $NODE_ARCH -o $TRIPLEO_ROOT/undercloud \
   boot-stack nova-baremetal os-collect-config stackuser $DHCP_DRIVER ironic
Note: This will install Ironic and the Ironic command line client on the undercloud image. It will configure ironic.conf to use the undercloud's services. At this point it will NOT configure the undercloud to use Ironic's services.

In step #2 we load the undercloud image containing Ironic you created above into glance:

load-image $TRIPLEO_ROOT/undercloud.qcow2

Before step #3, we need to merge the Ironic template with the undercloud template. To merge the two templates use TripleO's merge.py script. However, before the two templates can be merged, The TripleO's undercloud-vm.yaml file will need to be hacked.

sed -i 's/OpenStack::Heat::Stack: {}/OpenStack::Role: notcomputeConfig\n      OpenStack::Heat::Stack: {}/' $TRIPLEO_ROOT/tripleo-heat-templates/undercloud-vm.yaml
Note: TripleO is working hard to define a proper procedure for this.

Merge the Ironic and undercloud yaml files

python $TRIPLEO_ROOT/tripleo-heat-templates/merge.py $TRIPLEO_ROOT/tripleo-heat-templates/undercloud-vm.yaml  $TRIPLEO_ROOT/tripleo-heat-templates/ironic.yaml > $TRIPLEO_ROOT/UndercloudAndIronic.yaml
Note: this will create the UndercloudAndIronic.yaml file in the $TRIPLEO_ROOT directory.

Step #3 of the devtest_undercloud-walkthru creates the required passwords for the undercloud.

setup-passwords
source tripleo-passwords

Use the command below in place of devtest_undercloud-walkthru's step #4 to spin up the undercloud!

if [ "$DHCP_DRIVER" != "bm-dnsmasq" ]; then
    UNDERCLOUD_NATIVE_PXE=""
else
    UNDERCLOUD_NATIVE_PXE=";NeutronNativePXE=True"
fi

heat stack-create -f $TRIPLEO_ROOT/UndercloudAndIronic.yaml \
 -P "PowerUserName=$(whoami);\
AdminToken=${UNDERCLOUD_ADMIN_TOKEN};\
AdminPassword=${UNDERCLOUD_ADMIN_PASSWORD};\
GlancePassword=${UNDERCLOUD_GLANCE_PASSWORD};\
HeatPassword=${UNDERCLOUD_HEAT_PASSWORD};\
NeutronPassword=${UNDERCLOUD_NEUTRON_PASSWORD};\
NovaPassword=${UNDERCLOUD_NOVA_PASSWORD};\
BaremetalArch=${NODE_ARCH}$UNDERCLOUD_NATIVE_PXE" \
undercloud

Contine to follow devtest_undercloud-walkthru's up through step #8.

After step #8, register the Ironic service with keystone.

export UNDERCLOUD_IRONIC_PASSWORD=$(os-make-password)
PASSWORD=$UNDERCLOUD_IRONIC_PASSWORD register-endpoint -r "regionOne" -d "Ironic Service" ironic baremetal http://$UNDERCLOUD_IP:6385
Note: in devtest_undercloud-walkthru's step #9 nodes are registered to the underclouds nova-baremetal and not Ironic. See the Ironic command line client docs for examples on how to register nodes with Ironic.

Be sure to run devtest_undercloud-walkthru's step #10.
Once HEAT has finished its magic, "nova list" should show something like this:

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

this will be the Ironic node.
To login to the undercloud node with ssh, use a command like this

ssh heat-admin@$UNDERCLOUD_IP
Note: We included the stackuser element when we built our image so if you have console access you may also login on the console with " stack " as both username and password. Both users, "heat-admin" and "stack", have full sudo access.


Test it.

ssh heat-admin@$UNDERCLOUD_IP
sudo su -
source stackrc
ironic chassis-add --description MyFirstTestChassis
ironic chassis-list