OpenStack最新的版本 ESSEX出来了,需要为用户讲清楚,如何使用此系统所以要做实验,要认真分析此系统了,现在对这官方文档一步一步的做下来,实践出真知,肯定会有收获的。 先搞定手动安装,然后再使用Dell Crowbar自动化工具来进行批量安装部署,先手动了解原理,再自动提高生产效率,然后深入了解其工作原理及源代码,最终达到深刻理解的目标。 开始,行动!!!

OpenStack最新的版本 ESSEX出来了,需要为用户讲清楚,如何使用此系统所以要做实验,要认真分析此系统了,现在对这官方文档一步一步的做下来,实践出真知,肯定会有收获的。

先搞定手动安装,然后再使用Dell Crowbar自动化工具来进行批量安装部署,先手动了解原理,再自动提高生产效率,然后深入了解其工作原理及源代码,最终达到深刻理解的目标。

开始,行动!!!

=========================================================

参考文档:(Ubuntu 12.04 最新的操作系统,最新的OpenStack Release版本,新鲜出炉啊,而且身份认证和UI也包含进来了,应该是最全的配置了)

OpenStack Starter Guide for Ubuntu 12.04 - Compute, Object Storage (all-in-one), Image, and Identity services plus Dashboard

http://docs.openstack.org/essex/openstack-compute/starter/content/

先看看环境介绍吧,由于使用Laptop来做实验系统最好资源最少最好,了解搭建步骤就好,达到学习目标就好,看看一台虚机能否搭建,最多不超过两台虚机。

 Introduction

The following section describes how to set up a minimal cloud infrastructure based on OpenStack using 3 machines. These machines are referred to in this and subsequent chapters as Server1, Server2 and Client1. Server1 runs all the components of Nova, Glance, Swift, Keystone and Horizon (OpenStack Dashboard). Server2 runs only nova-compute. Since OpenStack components follow a shared-nothing policy, each component or any group of components can be installed on any server.

Client1 is not a required component. In our sample setup, it is used for bundling images, as a client to the web interface and to run OpenStack commands to manage the infrastructure. Having this client ensures that you do not need to meddle with the servers for tasks such as bundling. Also, bundling of desktop Systems including Windows will require a GUI and it is better to have a dedicated machine for this purpose. We would recommend this machine to be VT-Enabled so that KVM can be run which allows launching of VMs during image creation for bundling.

演示环境需要3台机器:Server1, Server2, Client1,Server1是大总管上面什么都装,Server2上面只装nova-compute,Client1不是必需的,用于创建Images,访问web interface,运行OpenStack命令来管理基础架构,OK!go on...

Table 2.1. Configuration
  Server1 Server2
Functionality All components of OpenStack including nova-compute nova-compute Client
Network Interfaces eth0 - Public N/W, eth1 - Private N/W eth0 - Public N/W, eth1 - Private N/W eth0 - Public N/W
IP addresses eth0 - 10.10.10.2, eth1 - 192.168.3.1 eth0 - 10.10.10.3, eth1 - 192.168.3.2 eth0 - 10.10.10.4
Hostname server1.example.com server2.example.com client.example.com
DNS servers 10.10.8.3 10.10.8.3 10.10.8.3
Gateway IP 10.10.10.1 10.10.10.1 10.10.10.1

 

Server1 安装部署过程 

Base OS -> Network Configuration -> NTP -> Databases -> Keystone -> Glance -> Nova -> Dashboard -> Swift

开始安装部署 Server1之前我们先要搞清楚Server1上要做哪些安装内容,先有个整体把握再各个击破,看了一下可以分为三个阶段:

1. 操作系统准备(BaseOS -> Network -> NTP)

2. 数据库准备(MySQL)

3. OpenStack组件安装(Keystone -> Glance -> Nova -> Dashboard -> Swift)

大体了解了,开工吧!

1. 操作系统准备(BaseOS -> Network -> NTP)

1.1 Base OS

安装Ubuntu server 12.04,没有的到这个地址下载吧或者找个离你最近的镜像地址下载吧(

http://releases.ubuntu.com/12.04/ubuntu-12.04-server-amd64.iso),设置用户名'localadmin',设置IP地址,只选择'Opessh-server'别的服务不选。

在Server1上面还要运行nova-volume,因此分区的时候手动分区为nova-volume留个分区,我觉得我用虚机新挂一块硬盘来搞定吧,手动分区嫌麻烦。

安装好系统之后,更新到最新,并且安装"bridge-utils",搞明白了就,动手,行动!!!

几分钟之后系统安装好了,我用虚拟机来安装的系统,创建的双网卡环境来模拟内网(Host-Only)和公网(NAT),接下来要更新一下源了,咱们得找中国的源更新或者安装软件会快一些。

=============================

ubuntu 12.04更新源方法:

ubuntu 12.04的开发代号是Precise Pangolin,译为精确的穿山甲。

1、首先备份Ubuntu 11.10源列表
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup (备份下当前的源列表,有备无患嘛)

2、修改更新源
sudo vi /etc/apt/sources.list (打开Ubuntu 11.10源列表文件)

#网易 Ubuntu 11.10 源(速度很快)
deb http://mirrors.163.com/ubuntu/ precise main universe restricted multiverse
deb-src http://mirrors.163.com/ubuntu/ precise main universe restricted multiverse
deb http://mirrors.163.com/ubuntu/ precise-security universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ precise-security universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ precise-updates universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ precise-proposed universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ precise-proposed universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ precise-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ precise-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ precise-updates universe main multiverse restricted

3、通知ubuntu启用新的更新源 sudo apt-get update

4、进行系统更新 sudo apt-get upgrade

 

Install 64 bit version of Ubuntu server 12.04 keeping the following configurations in mind.

  • Create the first user with the name 'localadmin' .

  • Installation lets you setup the IP address for the first interface i.e. eth0. Set the IP address details.

  • During installation select only Openssh-server in the packages menu.

We will also be running nova-volume on this server and it is ideal to have a dedicated partition for the use of nova-volume. So, ensure that you choose manual partitioning scheme while installing Ubuntu Server and create a dedicated partition with adequate amount of space for this purpose. We have referred to this partition in the rest of the chapter as /dev/sda6. You can substitute the correct device name of this dedicated partition based on your local setup while following the instructions. Also ensure that the partition type is set as Linux LVM (8e) using fdisk either during install or immediately after installation is over. If you also plan to use a dedicated partition as Swift backend, create another partition for this purpose and follow the instructions in "Swift Installation" section below.

Update the machine using the following commands.

sudo apt-get update
sudo apt-get upgrade

Install bridge-utils:

sudo apt-get install bridge-utils

 

================== Base OS 准备完毕 向下一步进发 ==========================

1. 操作系统准备(BaseOS -> Network -> NTP)

1.2 Network

由于要模拟外网和内网两个网络,而且都要静态地址,所以要编辑/etc/network/interfaces文件来设置静态地址和配置Gateway, DNS等信息。

为了配合OpenStack的部署,我也把VMware Workstation 网络配置进行了修改,将NAT的IP段设置为192.168.26.0, 255.255.255.0,将Host-Only的IP段设置为192.168.3.0, 255.255.255.0,这样模拟的就更加逼真了,行动!

Edit the /etc/network/interfaces file so as to looks like this:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 10.10.10.2
netmask 255.255.255.0
broadcast 10.10.10.255
gateway 10.10.10.1
dns-nameservers 10.10.8.3

auto eth1
iface eth1 inet static
address 192.168.3.2
netmask 255.255.255.0
network 192.168.3.0
broadcast 192.168.3.255

 

==== 实际配置如下: ======

sudo vi /etc/network/interfaces

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.26.128
netmask 255.255.255.0
broadcast 192.168.26.255
gateway 192.168.26.2
dns-nameservers 192.168.26.2

auto eth1
iface eth1 inet static
address 192.168.3.2
netmask 255.255.255.0
network 192.168.3.0
broadcast 192.168.3.255

sudo vi /etc/resolv.conf

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 192.168.26.2

Restart the network now

sudo /etc/init.d/networking restart

================== Network 准备完毕 向下一步进发 ==========================

1. 操作系统准备(BaseOS -> Network -> NTP)

1.3 NTP 配置

Server1 将扮演NTP Server的角色,为大家提供NTP服务。sudo apt-get install ntp 来安装ntp,/etc/ntp.conf 来进行配置。 

Install NTP package. This server shall act as the NTP server for the nodes. The time on all components of OpenStack will have to be in sync. We can run NTP server on server1 and have other servers/nodes sync to it.

sudo apt-get install ntp

Open the file /etc/ntp.conf and add the following lines to make sure that the time on the server stays in sync with an external server. If the Internet connectivity is down, the NTP server uses its own hardware clock as the fallback.

server ntp.ubuntu.com
server 127.127.1.0
fudge 127.127.1.0 stratum 10

Restart the NTP server

sudo service ntp restart

Ensure that, IP addresses of the servers are resolvable by the DNS. If not, include the hostnames in /etc/hosts file.

================== NTP 准备完毕 向下一步进发 ==========================

2. 数据库准备(MySQL)

MySQL数据库安装,设置数据库的密码: password,修改配置 /etc/mysql/my.cnf,搞定。

MySQL

Install mysql-server and python-mysqldb package

sudo apt-get install mysql-server python-mysqldb

Create the root password for mysql. The password used in this guide is "mygreatsecret"

Change the bind address from 127.0.0.1 to 0.0.0.0 in /etc/mysql/my.cnf. It should be identical to this:

bind-address = 0.0.0.0

Restart MySQL server to ensure that it starts listening on all interfaces.

sudo restart mysql

 

 

Creating Databases

Create MySQL databases to be used with nova, glance and keystone.

Create a database named nova.

sudo mysql -uroot -pmygreatsecret -e 'CREATE DATABASE nova;'

Create a user named novadbadmin.

sudo mysql -uroot -pmygreatsecret -e 'CREATE USER novadbadmin;'

Grant all privileges for novadbadmin on the database "nova".

sudo mysql -uroot -pmygreatsecret -e "GRANT ALL PRIVILEGES ON nova.* TO 'novadbadmin'@'%';"

Create a password for the user "novadbadmin".

sudo mysql -uroot -pmygreatsecret -e "SET PASSWORD FOR 'novadbadmin'@'%' = PASSWORD('novasecret');"

Create a database named glance.

sudo mysql -uroot -pmygreatsecret -e 'CREATE DATABASE glance;'

Create a user named glancedbadmin.

sudo mysql -uroot -pmygreatsecret -e 'CREATE USER glancedbadmin;'

Grant all privileges for glancedbadmin on the database "glance".

sudo mysql -uroot -pmygreatsecret -e "GRANT ALL PRIVILEGES ON glance.* TO 'glancedbadmin'@'%';"

Create a password for the user "glancedbadmin".

sudo mysql -uroot -pmygreatsecret -e "SET PASSWORD FOR 'glancedbadmin'@'%' = PASSWORD('glancesecret');"

Create a database named keystone.

sudo mysql -uroot -pmygreatsecret -e 'CREATE DATABASE keystone;'

Create a user named keystonedbadmin.

sudo mysql -uroot -pmygreatsecret -e 'CREATE USER keystonedbadmin;'

Grant all privileges for keystonedbadmin on the database "keystone".

sudo mysql -uroot -pmygreatsecret -e "GRANT ALL PRIVILEGES ON keystone.* TO 'keystonedbadmin'@'%';"

Create a password for the user "keystonedbadmin".

sudo mysql -uroot -pmygreatsecret -e "SET PASSWORD FOR 'keystonedbadmin'@'%' = PASSWORD('keystonesecret');"

 ================== MySQL数据库 准备完毕 向下一步进发 ==========================

3. OpenStack组件安装(Keystone -> Glance -> Nova -> Dashboard -> Swift)

Keystone

  安装 keystone -> 配置 Keystone /etc/keystone/keystone.conf admin_token = admin, connection = -> Restart keystone -> keystone-manage db_sync -> Export 环境变量。

Keystone is the identity service used by OpenStack. Install Keystone using the following command.

sudo apt-get install keystone python-keystone python-keystoneclient

Open /etc/keystone/keystone.conf and change the line

admin_token = ADMIN

so that it looks like the following:

admin_token = admin

(We have used 'admin' as the token in this book.)

Since MySQL database is used to store keystone configuration, replace the following line in /etc/keystone/keystone.conf

connection = sqlite:////var/lib/keystone/keystone.db

with

connection = mysql://keystonedbadmin:keystonesecret@10.10.10.2/keystone

Restart Keystone:

sudo service keystone restart

Run the following command to synchronise the database:

sudo keystone-manage db_sync

Export environment variables which are required while working with OpenStack.

export SERVICE_ENDPOINT="http://localhost:35357/v2.0"
export SERVICE_TOKEN=admin

You can also add these variables to ~/.bashrc, so that you need not have to export them everytime.

 

Creating Tenants

Create the tenants by executing the following commands. In this case, we are creating two tenants - admin and service.

keystone tenant-create --name admin
keystone tenant-create --name service


Creating Users

Create the users by executing the following commands. In this case, we are creating four users - admin, nova, glance and swift

keystone user-create --name admin --pass admin --email admin@foobar.com 
keystone user-create --name nova --pass nova   --email nova@foobar.com
keystone user-create --name glance --pass glance   --email glance@foobar.com
keystone user-create --name swift --pass swift   --email swift@foobar.com

Creating Roles

Create the roles by executing the following commands. In this case, we are creating two roles - admin and Member.

keystone role-create --name admin
keystone role-create --name Member

Listing Tenants, Users and Roles

The tenants, users and roles that have been created above can be listed by following commands:

List Tenants:

keystone tenant-list
+----------------------------------+--------------------+---------+
|                id                |        name        | enabled |
+----------------------------------+--------------------+---------+
| 7f95ae9617cd496888bc412efdceabfd | admin              | True    |
| c7970080576646c6959ee35970cf3199 | service            | True    |
+----------------------------------+--------------------+---------+

List Users:

keystone user-list
+----------------------------------+---------+-------------------+--------+
|                id                | enabled |       email       |  name  |
+----------------------------------+---------+-------------------+--------+
| 1b986cca67e242f38cd6aa4bdec587ca | True    | swift@foobar.com  | swift  |
| 518b51ea133c4facadae42c328d6b77b | True    | glance@foobar.com | glance |
| b3de3aeec2544f0f90b9cbfe8b8b7acd | True    | admin@foobar.com  | admin  |
| ce8cd56ca8824f5d845ba6ed015e9494 | True    | nova@foobar.com   | nova   |
+----------------------------------+---------+-------------------+--------+

List Roles:

keystone role-list
+----------------------------------+----------------------+
|                id                |         name         |
+----------------------------------+----------------------+
| 2bbe305ad531434991d4281aaaebb700 | admin                |
| d983800dd6d54ee3a1b1eb9f2ae3291f | Member               |
+----------------------------------+----------------------+

Please note that the values of the 'id' column, would be required later when we associate a role to a user in a particular tenant.

Adding Roles to Users in Tenants

Now we add roles to the users that have been created. A role to a specific user in a specific tenant can be assigned with the following command:

keystone user-role-add --user $USER_ID --role $ROLE_ID --tenant_id $TENANT_ID

The required 'id' can be obtained from the commands - keystone user-list, keystone tenant-list, keystone role-list.

To add a role of 'admin' to the user 'admin' of the tenant 'admin'.

keystone user-role-add --user b3de3aeec2544f0f90b9cbfe8b8b7acd --role 2bbe305ad531434991d4281aaaebb700 --tenant_id 7f95ae9617cd496888bc412efdceabfd

The following commands will add a role of 'admin' to the users 'nova', 'glance' and 'swift' of the tenant 'service'.

keystone user-role-add --user ce8cd56ca8824f5d845ba6ed015e9494 --role 2bbe305ad531434991d4281aaaebb700 --tenant_id c7970080576646c6959ee35970cf3199
keystone user-role-add --user 518b51ea133c4facadae42c328d6b77b --role 2bbe305ad531434991d4281aaaebb700 --tenant_id c7970080576646c6959ee35970cf3199
keystone user-role-add --user 1b986cca67e242f38cd6aa4bdec587ca --role 2bbe305ad531434991d4281aaaebb700 --tenant_id c7970080576646c6959ee35970cf3199

The 'Member' role is used by Horizon and Swift. So add the 'Member' role accordingly.

keystone user-role-add --user b3de3aeec2544f0f90b9cbfe8b8b7acd --role d983800dd6d54ee3a1b1eb9f2ae3291f --tenant_id 7f95ae9617cd496888bc412efdceabfd

Replace the id appropriately as listed by keystone user-list, keystone role-list, keystone tenant-list.

Creating Services

Now we need to create the required services which the users can authenticate with. nova-compute, nova-volume, glance, swift, keystone and ec2 are some of the services that we create.

keystone service-create --name service_name --type service_type --description 'Description of the service'
keystone service-create --name nova --type compute --description 'OpenStack Compute Service'
keystone service-create --name volume --type volume --description 'OpenStack Volume Service'
keystone service-create --name glance --type image --description 'OpenStack Image Service'
keystone service-create --name swift --type object-store --description 'OpenStack Storage Service'
keystone service-create --name keystone --type identity --description 'OpenStack Identity Service'
keystone service-create --name ec2 --type ec2 --description 'EC2 Service'

Each of the services that have been created above will be identified with a unique id which can be obtained from the following command:

keystone service-list
+----------------------------------+----------+--------------+----------------------------+
|                id                |   name   |     type     |        description         |
+----------------------------------+----------+--------------+----------------------------+
| 1e93ee6c70f8468c88a5cb1b106753f3 | nova     | compute      | OpenStack Compute Service  |
| 28fd92ffe3824004996a3e04e059d875 | ec2      | ec2          | EC2 Service                |
| 7d4ec192dfa1456996f0f4c47415c7a7 | keystone | identity     | OpenStack Identity Service |
| 96f35e1112b143e59d5cd5d0e6a8b22d | swift    | object-store | OpenStack Storage Service  |
| f38f4564ff7b4e43a52b2f5c1b75e5fa | volume   | volume       | OpenStack Volume Service   |
| fbafab6edcab467bb734380ce6be3561 | glance   | image        | OpenStack Image Service    |
+----------------------------------+----------+--------------+----------------------------+

The 'id' will be used in defining the endpoint for that service.

 Creating Endpoints

Create endpoints for each of the services that have been created above.

keystone endpoint-create --region region_name --service_id service_id --publicurl public_url --adminurl admin_url  --internalurl internal_url

For creating an endpoint for nova-compute, execute the following command:

keystone endpoint-create --region myregion --service_id 1e93ee6c70f8468c88a5cb1b106753f3 --publicurl 'http://10.10.10.2:8774/v2/$(tenant_id)s' --adminurl 'http://10.10.10.2:8774/v2/$(tenant_id)s' --internalurl 'http://10.10.10.2:8774/v2/$(tenant_id)s'

For creating an endpoint for nova-volume, execute the following command:

keystone endpoint-create --region myregion --service_id f38f4564ff7b4e43a52b2f5c1b75e5fa --publicurl 'http://10.10.10.2:8776/v1/$(tenant_id)s' --adminurl 'http://10.10.10.2:8776/v1/$(tenant_id)s' --internalurl 'http://10.10.10.2:8776/v1/$(tenant_id)s'

For creating an endpoint for glance, execute the following command:

keystone endpoint-create --region myregion --service_id fbafab6edcab467bb734380ce6be3561 --publicurl 'http://10.10.10.2:9292/v1' --adminurl 'http://10.10.10.2:9292/v1' --internalurl 'http://10.10.10.2:9292/v1'

For creating an endpoint for swift, execute the following command:

keystone endpoint-create --region myregion --service_id 96f35e1112b143e59d5cd5d0e6a8b22d --publicurl 'http://10.10.10.2:8080/v1/AUTH_$(tenant_id)s' --adminurl 'http://10.10.10.2:8080/v1' --internalurl 'http://10.10.10.2:8080/v1/AUTH_$(tenant_id)s'

For creating an endpoint for keystone, execute the following command:

keystone endpoint-create --region myregion --service_id 7d4ec192dfa1456996f0f4c47415c7a7 --publicurl http://10.10.10.2:5000/v2.0 --adminurl http://10.10.10.2:35357/v2.0 --internalurl http://10.10.10.2:5000/v2.0

For creating an endpoint for ec2, execute the following command:

keystone endpoint-create --region myregion --service_id 28fd92ffe3824004996a3e04e059d875 --publicurl http://10.10.10.2:8773/services/Cloud --adminurl http://10.10.10.2:8773/services/Admin --internalurl http://10.10.10.2:8773/services/Cloud

 

================== Keystone 准备完毕 向下一步进发 ==========================

 

3. OpenStack组件安装(Keystone -> Glance -> Nova -> Dashboard -> Swift)

Glance

 

Install glance using the following command:

sudo apt-get install glance glance-api glance-client glance-common glance-registry python-glance

Glance Configuration

Glance uses SQLite by default. MySQL and PostgreSQL can also be configured to work with Glance.

Open /etc/glance/glance-api-paste.ini and at the end of the file, edit the following lines:

admin_tenant_name = %SERVICE_TENANT_NAME%
admin_user = %SERVICE_USER%
admin_password = %SERVICE_PASSWORD%

These values have to be modified as per the configurations made earlier. The admin_tenant_name will be 'service', admin_user will be 'glance' and admin_password is 'glance'.

After editing, the lines should be as follows:

admin_tenant_name = service
admin_user = glance
admin_password = glance

Now open /etc/glance/glance-registry-paste.ini and make similar changes at the end of the file.

Open the file /etc/glance/glance-registry.conf and edit the line which contains the option "sql_connection =" to this:

sql_connection = mysql://glancedbadmin:glancesecret@10.10.10.2/glance

In order to tell glance to use keystone for authentication, add the following lines at the end of the file.

[paste_deploy]
flavor = keystone

Open /etc/glance/glance-api.conf and add the following lines at the end of the document.

[paste_deploy]
flavor = keystone

Create glance schema in the MySQL database.:

sudo glance-manage version_control 0
sudo glance-manage db_sync

Restart glance-api and glance-registry after making the above changes.

sudo restart glance-api
sudo restart glance-registry

Export the following environment variables.

export SERVICE_TOKEN=admin
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=admin
export OS_AUTH_URL="http://localhost:5000/v2.0/"
export SERVICE_ENDPOINT=http://localhost:35357/v2.0

Alternatively, you can add these variables to ~/.bashrc.

To test if glance is setup correectly execute the following command.

glance index

The above command will not return any output. The output of the last command executed can be known from its return code - echo $?. If the return code is zero, then glance is setup properly and connects with Keystone.

With glance configured properly and using keystone as the authentication mechanism, now we can upload images to glance. This has been explained in detail in "Image Management" chapter.

 

================== Glance 准备完毕 向下一步进发 ==========================

3. OpenStack组件安装(Keystone -> Glance -> Nova -> Dashboard -> Swift)

Nova

Install nova using the following commands:

sudo apt-get install nova-api nova-cert nova-compute nova-compute-kvm nova-doc nova-network nova-objectstore nova-scheduler nova-volume rabbitmq-server novnc nova-consoleauth







Nova Configuration

Edit the /etc/nova/nova.conf file to look like this.

--dhcpbridge_flagfile=/etc/nova/nova.conf
--dhcpbridge=/usr/bin/nova-dhcpbridge
--logdir=/var/log/nova
--state_path=/var/lib/nova
--lock_path=/run/lock/nova
--allow_admin_api=true
--use_deprecated_auth=false
--auth_strategy=keystone
--scheduler_driver=nova.scheduler.simple.SimpleScheduler
--s3_host=10.10.10.2
--ec2_host=10.10.10.2
--rabbit_host=10.10.10.2
--cc_host=10.10.10.2
--nova_url=http://10.10.10.2:8774/v1.1/
--routing_source_ip=10.10.10.2
--glance_api_servers=10.10.10.2:9292
--image_service=nova.image.glance.GlanceImageService
--iscsi_ip_prefix=192.168.4
--sql_connection=mysql://novadbadmin:novasecret@10.10.10.2/nova
--ec2_url=http://10.10.10.2:8773/services/Cloud
--keystone_ec2_url=http://10.10.10.2:5000/v2.0/ec2tokens
--api_paste_config=/etc/nova/api-paste.ini
--libvirt_type=kvm
--libvirt_use_virtio_for_bridges=true
--start_guests_on_host_boot=true
--resume_guests_state_on_host_boot=true
# vnc specific configuration
--novnc_enabled=true
--novncproxy_base_url=http://10.10.10.2:6080/vnc_auto.html
--vncserver_proxyclient_address=10.10.10.2
--vncserver_listen=10.10.10.2
# network specific settings
--network_manager=nova.network.manager.FlatDHCPManager
--public_interface=eth0
--flat_interface=eth1
--flat_network_bridge=br100
--fixed_range=192.168.4.1/27
--floating_range=10.10.10.2/27
--network_size=32
--flat_network_dhcp_start=192.168.4.33
--flat_injected=False
--force_dhcp_release
--iscsi_helper=tgtadm
--connection_type=libvirt
--root_helper=sudo nova-rootwrap
--verbose

Create a Physical Volume.

sudo pvcreate /dev/sda6

Create a Volume Group named nova-volumes.

sudo vgcreate nova-volumes /dev/sda6

Change the ownership of the /etc/nova folder and permissions for /etc/nova/nova.conf:

sudo chown -R nova:nova /etc/nova
sudo chmod 644 /etc/nova/nova.conf

Open /etc/nova/api-paste.ini and at the end of the file, edit the following lines:

admin_tenant_name = %SERVICE_TENANT_NAME%
admin_user = %SERVICE_USER%
admin_password = %SERVICE_PASSWORD%

These values have to be modified conforming to configurations made earlier. The admin_tenant_name will be 'service', admin_user will be 'nova' and admin_password is 'nova'.

After editing, the lines should be as follows:

admin_tenant_name = service
admin_user = nova
admin_password = nova

Create nova schema in the MySQL database.

sudo nova-manage db sync

Provide a range of IPs to be associated to the instances.

sudo nova-manage network create private --fixed_range_v4=192.168.4.32/27 --num_networks=1 --bridge=br100 --bridge_interface=eth1 --network_size=32 

Export the following environment variables.

export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=admin
export OS_AUTH_URL="http://localhost:5000/v2.0/"

Restart nova services.

sudo restart libvirt-bin; sudo restart nova-network; sudo restart nova-compute; sudo restart nova-api; sudo restart nova-objectstore; sudo restart nova-scheduler; sudo restart nova-volume; sudo restart nova-consoleauth;

To test if nova is setup correctly run the following command.

sudo nova-manage service list
Binary           Host              Zone             Status     State Updated_At
nova-network     server1           nova             enabled    :-)   2012-04-20 08:58:43
nova-scheduler   server1           nova             enabled    :-)   2012-04-20 08:58:44
nova-volume      server1           nova             enabled    :-)   2012-04-20 08:58:44
nova-compute     server1           nova             enabled    :-)   2012-04-20 08:58:45
nova-cert        server1           nova             enabled    :-)   2012-04-20 08:58:43

If the output is similar to the above with all components happy, your setup is ready to be used.

================== Nova 准备完毕 向下一步进发 ==========================

3. OpenStack组件安装(Keystone -> Glance -> Nova -> Dashboard -> Swift)

Dashboard

 OpenStack Dashboard

Install OpenStack Dashboard by executing the following command:

sudo apt-get install openstack-dashboard

Restart apache with the following command:

sudo service apache2 restart

Open a browser and enter IP address of the server1. You should see the OpenStack Dashboard login prompt. Login with username 'admin' and password 'admin'. From the dashboard, you can create keypairs, create/edit security groups, raise new instances, attach volumes etc. which are explained in "OpenStack Dashboard" chapter.

================== Dashboard 准备完毕 向下一步进发 ==========================

3. OpenStack组件安装(Keystone -> Glance -> Nova -> Dashboard -> Swift)

Swift

 

 Swift Installation

The primary components are the proxy, account, container and object servers.

sudo apt-get install swift swift-proxy swift-account swift-container swift-object

Other components that might be xfsprogs (for dealing with XFS filesystem), python.pastedeploy (for keystone access), curl (to test swift).

sudo apt-get install xfsprogs curl python-pastedeploy

 Swift Storage Backends

There are two methods one can try to create/prepare the storage backend. One is to use an existing partition/volume as the storage device. The other is to create a loopback file and use it as the storage device. Use the appropriate method as per your setup.

 

================= Swift 准备完毕 向下一步进发 ==========================