现在的位置: 首页 > 综合 > 正文

How to create openstack single node with devstack

2013年09月23日 ⁄ 综合 ⁄ 共 2989字 ⁄ 字号 评论关闭

1) Pre-requirements: Install Ubuntu 12.04

root@nova:~# cat /etc/*release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04 LTS"

2) Install some libs which is required by openstack

apt-get install libxml2-dev libxslt-dev
apt-get install libmysqlclient-dev

3) Install devstack following: http://devstack.org/

   3.1) We can use essex version, this is more stable. Check it out using:

git clone -b "stable/essex" git://github.com/openstack-dev/devstack.git

   3.2) Create a localrc file which can help facilitate your installation, the content would be as following, put this file to the first level directory for devstack.

root@nova:~/devstack# cat localrc
ADMIN_PASSWORD=nova
MYSQL_PASSWORD=nova
RABBIT_PASSWORD=nova
SERVICE_PASSWORD=nova
SERVICE_TOKEN=tokentoken
FLAT_INTERFACE=br100

   3.3) run ./stack.sh, wait some time, openstack will be ready.

4)Use openstack
Once install finished, you can either use euca2ools or nova command to operate with openstack. The location of openstack after install is under /opt/stack

root@nova:/opt/stack# pwd
/opt/stack
root@nova:/opt/stack# pwd
/opt/stack
root@nova:/opt/stack# cd devstack/
root@nova:/opt/stack/devstack# ls
AUTHORS  eucarc  exerciserc  exercises  exercise.sh  files  functions  HACKING.rst  LICENSE  localrc  nova_help  openrc  README.md  rejoin-stack.sh  samples  stackrc  stack-screenrc  stack.sh  tests  tools  unstack.sh
root@nova:/opt/stack/devstack# source openrc admin admin
root@nova:/opt/stack/devstack# source eucarc admin admin
root@nova:/opt/stack/devstack# euca-describe-images
IMAGE   aki-00000001    None (cirros-0.3.0-x86_64-uec-kernel)           available       public                  kernel                          instance-store
IMAGE   ami-00000002    None (cirros-0.3.0-x86_64-uec)          available       public                  machine aki-00000001    ari-00000003            instance-store
IMAGE   ari-00000003    None (cirros-0.3.0-x86_64-uec-ramdisk)          available       public                  ramdisk                         instance-store
root@nova:/opt/stack/devstack# nova flavor-list
+----+-----------+-----------+------+-----------+------+-------+-------------+
| ID |    Name   | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor |
+----+-----------+-----------+------+-----------+------+-------+-------------+
| 1  | m1.tiny   | 512       | 0    | 0         |      | 1     | 1.0         |
| 2  | m1.small  | 2048      | 10   | 20        |      | 1     | 1.0         |
| 3  | m1.medium | 4096      | 10   | 40        |      | 2     | 1.0         |
| 4  | m1.large  | 8192      | 10   | 80        |      | 4     | 1.0         |
| 5  | m1.xlarge | 16384     | 10   | 160       |      | 8     | 1.0         |
+----+-----------+-----------+------+-----------+------+-------+-------------+

5) Source code
Once openstack install finished, the source code is under /opt/stack.

 horizon: openstack GUI
 keystone: authentication and authrization
 nova: major componment for provisioning and scheduling

6) How to read source code
You can import source code to eclipse, make sure use Python2.7, seems Python 3.x does not work with eclipse.
This link is about how to config eclipse, though it is in Chinese but there are some screenshots and this may help you.

7) How to debug
Just kill the nova process, add pdb to source code and start up the process manually.
for example, it we want to debug nova-scheduler, just kill nova-scheduler, then add pdb to the code where you want to debug and remove all *.pyc files, start up nova-scheduler using command "python /opt/stack/nova/bin/nova-scheduler", all the logs will be printed
to screen and will stop at  the break point once the break point was  triggered.

8) Attention
Please re-run ./stack.sh once the host is rebooted.

抱歉!评论已关闭.