Ironic简化安装通常适用于开发者搭建开发原型环境,可以不依赖于OpenStack的其他组件,将Ironic的内部组件运转起来。以Ubuntu系统为例,环境为Python2.7。
1)安装Ironic依赖包。
sudo apt-get install python-dev libssl-dev python-pip libmysqlclient- dev libxml1-dev libxslt-dev libpq-dev git git-review libffi-dev gettext ipmitool psmisc graphviz
2)安装virtualenv环境。
sudo easy_install nosesudo pip install virtualenv setuptools-git flake8 tox testrepository
3)安装rabbit-mq和mysql。
# install rabbit message broker# Ubuntu/Debian:sudo apt-get install rabbitmq-server# optionally, install mysql-server# Ubuntu/Debian:# sudo apt-get install mysql-server
4)从git下载Ironic代码库,并使用virtualenv安装。
# activate the virtualenvcd ~git clone https://git.openstack.org/openstack/ironiccd ironictox -evenv --notestsource .tox/venv/bin/activate# install ironic within the virtualenvpython setup.py develop
5)配置Ironic配置文件。
# copy sample config and modify it as necessarycp etc/ironic/ironic.conf.sample etc/ironic/ironic.conf.local# disable auth since we are not running keystone heresed -i "s/#auth_strategy=keystone/auth_strategy=noauth/" etc/ironic/ironic.conf.local# Use the 'fake_ipmitool' test driversed -i "s/#enabled_drivers=pxe_ipmitool/enabled_drivers=fake_ipmitool/" etc/ironic/ironic.conf.local# set a fake host name [useful if you want to test multiple services on the same host]sed -i "s/#host=.*/host=test-host/" etc/ironic/ironic.conf.local# turn off the periodic sync_power_state task, to avoid getting NodeLocked exceptionssed -i "s/#sync_power_state_interval=60/sync_power_state_interval=-1/" etc/ironic/ironic.conf.local
6)初始化Ironic数据库,根据实际情况配置数据库连接。
mysql -u root -e “create schema ironic”sed -i “s/#connection=.*/connection=mysql://[email protected]/ironic/” etc/ironic/ironic.conf.localironic-dbsync --config-file etc/ironic/ironic.conf.local create_schema
7)debug模式启动ironic-api。
# start the API serviceironic-api -v -d --config-file etc/ironic/ironic.conf.local
8)debug模式启动Ironic-conductor。
ironic-conductor -v -d --config-file etc/ironic/ironic.conf.local
9)安装ironic-pythonclient。
# from your home or source directorycd ~git clone https://git.openstack.org/openstack/python-ironicclientcd python-ironicclienttox -evenv --notestsource .tox/venv/bin/activateexport OS_AUTH_TOKEN=fake-tokenexport IRONIC_URL=http://localhost:6385/
现在可以使用ironic命令与ironic-api交互了,也可以测试Ironic接口了。
# get a list of available commandsironic help# get the list of drivers currently supported by the available conductor(s)ironic driver-list# get a list of nodes (should be empty at this point)ironic node-list
也可以注册一个伪节点。
MAC="aa:bb:cc:dd:ee:ff" # replace with the MAC of a data port on your nodeIPMI_ADDR="1.2.3.4" # replace with a real IP of the node BMCIPMI_USER="admin" # replace with the BMC's user nameIPMI_PASS="pass" # replace with the BMC's password# enroll the node with the "fake" deploy driver and the "ipmitool" power driver# Note that driver info may be added at node creation time with "-i"NODE=$(ironic node-create -d fake_ipmitool -i ipmi_address=$IPMI_ADDR -i ipmi_username=$IPMI_USER | grep ' uuid ' | awk '{print $4}')# driver info may also be added or updated later onironic node-update $NODE add driver_info/ipmi_password=$IPMI_PASS# add a network portironic port-create -n $NODE -a $MAC# view the information for the nodeironic node-show $NODE# request that the node's driver validate the supplied informationironic node-validate $NODE# you have now enrolled a node sufficiently to be able to control# its power state from ironic!ironic node-set-power-state $NODE on