讀古今文學網 > OpenStack系統架構設計實戰 > 7.5.2 簡化安裝 >

7.5.2 簡化安裝

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://root@localhost/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