Difference between revisions of "Ironic"
(→Merge the Ironic and undercloud yaml files) |
(→Register the Ironic service: simplify registering the VM with ironic, using python-ironicclient from the host) |
||
Line 192: | Line 192: | ||
==== Continue [http://docs.openstack.org/developer/tripleo-incubator/devtest_undercloud.html devtest_undercloud-walkthru] ==== | ==== Continue [http://docs.openstack.org/developer/tripleo-incubator/devtest_undercloud.html devtest_undercloud-walkthru] ==== | ||
Continue to follow the [http://docs.openstack.org/developer/tripleo-incubator/devtest_undercloud.html devtest_undercloud-walkthru] up through step #8. | Continue to follow the [http://docs.openstack.org/developer/tripleo-incubator/devtest_undercloud.html devtest_undercloud-walkthru] up through step #8. | ||
+ | |||
+ | ==== Install the Ironic client ==== | ||
+ | |||
+ | If you haven't already installed the python-ironicclient library, you can run it within a virtual environment: | ||
+ | |||
+ | git clone https://git.openstack.org/openstack/python-ironicclient | ||
+ | cd python-ironicclient | ||
+ | tox -evenv -- echo done | ||
+ | source .tox/venv/bin/activate | ||
==== Register the Ironic service ==== | ==== Register the Ironic service ==== | ||
Line 202: | Line 211: | ||
export UNDERCLOUD_MAC=$(create-nodes $NODE_CPU $NODE_MEM $NODE_DISK $NODE_ARCH 1) | export UNDERCLOUD_MAC=$(create-nodes $NODE_CPU $NODE_MEM $NODE_DISK $NODE_ARCH 1) | ||
− | + | Allow Ironic's SSH driver to connect to your local machine: | |
− | ssh heat-admin@$UNDERCLOUD_IP | + | ssh heat-admin@$UNDERCLOUD_IP "cat /opt/stack/boot-stack/virtual-power-key.pub" >> ~/.ssh/authorized_keys |
− | + | ssh heat-admin@$UNDERCLOUD_IP "sudo chown ironic:ironic /opt/stack/boot-stack/virtual-power-key*" | |
− | source | + | |
− | ironic chassis-create -d TestChassis | + | Copy the Ironic API credentials to your local machine: |
− | ironic node-create -c | + | ssh heat-admin@$UNDERCLOUD_IP -- 'sudo cat /root/stackrc' > $TRIPLEO_ROOT/tripleo-incubator/ironicrc |
− | ironic port-create -a | + | sed -i "s/localhost/$UNDERCLOUD_IP/" $TRIPLEO_ROOT/tripleo-incubator/ironicrc |
+ | source $TRIPLEO_ROOT/tripleo-incubator/ironicrc | ||
+ | |||
+ | Use the ''ironic'' client to add and configure the baremetal node: | ||
+ | HOST_IP=$(ip addr show virbr0 | grep inet | awk '{print $2}' | sed 's/\/[0-9]*//') | ||
+ | CHASSIS=$(ironic chassis-create -d TestChassis | grep uuid | awk '{print $4}') | ||
+ | NODE=$(ironic node-create -c $CHASSIS -d pxe_ssh | grep uuid | awk '{print $4}') | ||
+ | ironic port-create -n $NODE -a $UNDERCLOUD_MAC | ||
+ | ironic node-update $NODE add \ | ||
+ | driver_info/ssh_virt_type=virsh \ | ||
+ | driver_info/ssh_address=$HOST_IP \ | ||
+ | driver_info/ssh_key_filename=/opt/stack/boot-stack/virtual-power-key \ | ||
+ | driver_info/ssh_username=$(whoami) | ||
− | + | You can now control the power state of the 'baremetal' node with this command: | |
+ | ironic node-set-power-state $NODE on | ||
+ | ironic node-show $NODE | ||
==== Test it ==== | ==== Test it ==== |
Revision as of 20:23, 6 December 2013
Source code |
Code review board |
Bug tracker |
Blueprints |
Developer docs |
Weekly meetings |
Contents
- 1 Ironic: Bare Metal provisioning for OpenStack
- 1.1 Building Documentation Locally
- 1.2 Try it on Devstack
- 1.3 Using Disk Image Builder
- 1.3.1 Add Ironic to the undercloud
- 1.3.2 Load Undercloud image
- 1.3.3 Create the required passwords
- 1.3.4 Merge the Ironic and undercloud yaml files
- 1.3.5 Boot the Ironic undercloud image
- 1.3.6 Continue devtest_undercloud-walkthru
- 1.3.7 Install the Ironic client
- 1.3.8 Register the Ironic service
- 1.3.9 Test it
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 is under rapid development and may invalidate this walk thru.
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. Here are some good starting points:
Please follow TripleO's Devtest-Doc up to the devtest_undercloud section.
Add Ironic to the undercloud
Before doing step #1 of devtest_undercloud-walkthru, Download the Nova-ironic, and modified Nova element from NobodyCam's-repo. After downloading the elements replace TripleO's Nova element with the one just downloaded, and move the downloaded Nova-ironic element in to the ELEMENTS_PATH ($TRIPLEO_ROOT/tripleo-image-elements/elements). Then add 'ironic' argument to the disk-image-create command:
cd $TRIPLEO_ROOT export UNDERCLOUD_DIB_EXTRA_ARGS="nova-ironic"
Then do step #1, $TRIPLEO_ROOT/diskimage-builder/bin/disk-image-create...
- 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 Undercloud image
Step #2 of devtest_undercloud-walkthru loads the undercloud image containing Ironic you created above, into glance:
load-image $TRIPLEO_ROOT/undercloud.qcow2
Create the required passwords
Step #3 of the devtest_undercloud-walkthru creates the required passwords for the undercloud.
setup-undercloud-passwords source tripleo-undercloud-passwords
- Note: until this-review lands you will need to manually create the IRONIC password.
export UNDERCLOUD_IRONIC_PASSWORD=$(os-make-password)
Merge the Ironic and undercloud yaml files
Step #4 of the devtest_undercloud-walkthru needs to be modified to create required Ironic yaml file. Use the make command below to create the correct yaml file.
make -C $TRIPLEO_ROOT/tripleo-heat-templates undercloud-vm-ironic.yaml
- Note: it will create the $TRIPLEO_ROOT/tripleo-heat-templates/undercloud-vm-ironic.yaml file.
Boot the Ironic undercloud image
Use the command below in place of devtest_undercloud-walkthru's step #4 to spin up the undercloud! (It uses undercloud-vm-ironic.yaml instead of the tripleo-heat-templates/undercloud-vm.yaml and adds IronicPassword=${UNDERCLOUD_IRONIC_PASSWORD}.)
heat stack-create -f $TRIPLEO_ROOT/tripleo-heat-templates/undercloud-vm-ironic.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};\ IronicPassword=${UNDERCLOUD_IRONIC_PASSWORD}" \ undercloud
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.
After doing step #5 of devtest_undercloud-walkthru's, you will be able 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.
Continue devtest_undercloud-walkthru
Continue to follow the devtest_undercloud-walkthru up through step #8.
Install the Ironic client
If you haven't already installed the python-ironicclient library, you can run it within a virtual environment:
git clone https://git.openstack.org/openstack/python-ironicclient cd python-ironicclient tox -evenv -- echo done source .tox/venv/bin/activate
Register the Ironic service
After step #8, register the Ironic service with keystone.
PASSWORD=$UNDERCLOUD_IRONIC_PASSWORD register-endpoint -r "regionOne" -d "Ironic Service" ironic baremetal http://$UNDERCLOUD_IP:6385
In devtest_undercloud-walkthru's step #9, nodes are registered to the undercloud's nova-baremetal and not Ironic. Instead of that, we'll create a 'baremetal' node and register it with ironic, via the undercloud.
This will create a 'baremetal' node:
export UNDERCLOUD_MAC=$(create-nodes $NODE_CPU $NODE_MEM $NODE_DISK $NODE_ARCH 1)
Allow Ironic's SSH driver to connect to your local machine:
ssh heat-admin@$UNDERCLOUD_IP "cat /opt/stack/boot-stack/virtual-power-key.pub" >> ~/.ssh/authorized_keys ssh heat-admin@$UNDERCLOUD_IP "sudo chown ironic:ironic /opt/stack/boot-stack/virtual-power-key*"
Copy the Ironic API credentials to your local machine:
ssh heat-admin@$UNDERCLOUD_IP -- 'sudo cat /root/stackrc' > $TRIPLEO_ROOT/tripleo-incubator/ironicrc sed -i "s/localhost/$UNDERCLOUD_IP/" $TRIPLEO_ROOT/tripleo-incubator/ironicrc source $TRIPLEO_ROOT/tripleo-incubator/ironicrc
Use the ironic client to add and configure the baremetal node:
HOST_IP=$(ip addr show virbr0 | grep inet | awk '{print $2}' | sed 's/\/[0-9]*//') CHASSIS=$(ironic chassis-create -d TestChassis | grep uuid | awk '{print $4}') NODE=$(ironic node-create -c $CHASSIS -d pxe_ssh | grep uuid | awk '{print $4}') ironic port-create -n $NODE -a $UNDERCLOUD_MAC ironic node-update $NODE add \ driver_info/ssh_virt_type=virsh \ driver_info/ssh_address=$HOST_IP \ driver_info/ssh_key_filename=/opt/stack/boot-stack/virtual-power-key \ driver_info/ssh_username=$(whoami)
You can now control the power state of the 'baremetal' node with this command:
ironic node-set-power-state $NODE on ironic node-show $NODE
Test it
ssh heat-admin@$UNDERCLOUD_IP sudo su - source stackrc ironic chassis-create --description MyFirstTestChassis ironic chassis-list