目的就是分享openstack 的安装文档,

同时 我自己试验,感谢陈沙克老师的博客。因为下定决心学一门新的技术或者做一件事不容易。


这个文档是描述Openstack Essex安装,把所有的服务安装在一台机器上。包括组件Nova,Keystone, Glance, Dashboard.

基本介绍

Openstack的网络比较复杂,也很难理解。大家可以直接看http://www.mirantis.com/blog/openstack-networking-flatmanager-and-flatdhcpmanager/

wKioL1NDbBGT96wvAADfEbUrTy8801.jpg

上图的例子:10.0.0.0/24, 是fix IP的网络。这是multihost=true的设置。这个图是可以很好帮助大家理解Openstack的网络。

  • 我文档和这个图有点不一样,我是使用eth1做为bridge,而不是eth0

  • 虚拟机间互相通讯,是直接通过br100通信

  • 和外网通信,才需要通过另外一块网卡,floating IP

    准备系统

    安装ubuntu 12.04

    最小化安装,只需要安装ssh server就可以。

    apt-get update && apt-get -y dist-upgrade

    设置网络

    Eth0: 10.1.199.17

    Eth1: 不需要设置IP

    可根据自己的ip 自己调整

  • 编辑 /etc/network/interfaces,需要注意一点是对于ubuntu 12.04,dns的设置,推荐在网卡设置。

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 10.1.199.17
hwaddress ether 00:25:90:67:ce:64 (根据ifconfig 的网卡MAC 地址更改)
netmask 255.255.255.0
network 10.1.199.0
gateway 10.1.199.1
dns-search bgi.cn
nameservers 8.8.8.8 (根据自己的dns 服务器设置)
auto eth1
iface eth1 inet manual
up ifconfig eth1 up

查看当前网卡情况

# mii-tool
eth0: negotiated 1000baseT-FD flow-control, link ok
eth1: negotiated 1000baseT-FD flow-control, link ok

设置hostname (可选)

这是我的习惯,Openstack基本是不需要使用hostname。大家可以忽略。(陈沙克)

# cat /etc/hostname
node17
# cat /etc/hosts
127.0.0.1       localhost
10.1.199.17       node17.chenshake.com    node17
# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
# hostname
node17
# hostname -f
node17.chenshake.com

NTP服务器

对于单节点来说,NTP服务器,并不是必须的。如果是多台机器的环境。就需要设置所有的节点,都吧ntp服务指向相同的一个ntp服务器上。

apt-get -y install ntp

设置NTP

编辑 /etc/ntp.conf ,在 server ntp.ubuntu.com 下添加两行

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

或者直接运行下面命令

sed -i 's/server ntp.ubuntu.com/server ntp.ubuntu.com\nserver 127.127.1.0\nfudge 127.127.1.0 stratum 10/g' /etc/ntp.conf

重启NTP服务

#service ntp restart

上面设置 server 127.127.1.0 的含义,大家可以参考文档


设置ISCSI (可选)

这是为Nova-volume服务使用的。不过目前nova-volume并不稳定,大家测试一下就可以。未来的Folsom版本,将会有新的组件来替代Nova-volume。

如果你不测试nova volume,可以不安装

apt-get -y install tgt

nova-compute节点,需要安装ISCSI客户端

apt-get install -y open-iscsi open-iscsi-utils


Nova-volume (可选)

如果你没有单独的分区,那么就不建议你测试,采用文件模拟的方式,基本是不可行。

我安装系统的时候,创建了一个nova-volume的分区,我先umount,再创建一个volume,名字为nova-volumes。nova的默认使用的volume的名字就是叫 nova-volumes. 如果你希望改变,就需要指定在nova.conf 文件里。

查看分区情况

# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda8       623G  941M  591G   1% /
udev            2.0G  4.0K  2.0G   1% /dev
tmpfs           790M  276K  789M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            2.0G     0  2.0G   0% /run/shm
/dev/sda1       138M   30M  101M  23% /boot
/dev/sda7        97G  188M   92G   1% /nova-volume
/dev/sda6        97G  188M   92G   1% /swift

创建nova-volumes 卷

umount /dev/sda7
pvcreate /dev/sda7
vgcreate nova-volumes /dev/sda7

编辑 /etc/fstab , 注释掉nova-volumes开机加载,否则会导致你开机无法启动。我是安装过程,直接创建了一个nova-volume的分区

sed -i '/nova-volume/s/^/#/' /etc/fstab

Bridge

目前Openstack的网络是通过linux的bridge和iptables来实现的。

apt-get -y install bridge-utils

重启网络

/etc/init.d/networking restart

RabbitMQ和Memcache 等

RabbitMQ是用来做调度使用。Memcache是给Dashboard使用。

apt-get install -y rabbitmq-server memcached python-memcache kvm libvirt-bin curl

环境变量

大家经常参考文档安装不成功,基本都是因为你修改的IP地址或者你更改了我文档默认的密码。为了让文档更加灵活,所以需要设置一下环境变量。

你可以根据你的实际情况修改admin的密码和mysql的密码。下面文档和数据库相关的密码都是相同,你只需要修改novarc就可以。

运行完下面的命令,你再对novarc进行修改。

cat >/root/novarc <<EOF
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=password
export MYSQL_PASS=password
export SERVICE_PASSWORD=password
export FIXED_RANGE=10.0.0.0/24
export FLOATING_RANGE=$(/sbin/ifconfig eth0 | awk '/inet addr/ {print $2}' | cut -f2 -d ":" | awk -F "." '{print $1"."$2"."$3}').224/27
export OS_AUTH_URL="http://localhost:5000/v2.0/"
export SERVICE_ENDPOINT="http://localhost:35357/v2.0"
export SERVICE_TOKEN=$(openssl rand -hex 10)
export MASTER="$(/sbin/ifconfig eth0 | awk '/inet addr/ {print $2}' | cut -f2 -d ":")"
EOF

根据你的需求进行调整,

我的novarc的内容

# cat novarc
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=password
export MYSQL_PASS=password
export SERVICE_PASSWORD=password
export FIXED_RANGE=10.0.0.0/24
export FLOATING_RANGE=10.1.199.224/27
export OS_AUTH_URL="http://localhost:5000/v2.0/"
export SERVICE_ENDPOINT="http://localhost:35357/v2.0"
export SERVICE_TOKEN=d5d892e6de00a922f9fb
export MASTER="10.1.199.17"

确认没有问题或者进行修改,运行

source novarc
echo "source novarc">>.bashrc

MYSQL

在Openstack组件里,Nova,Keystone, Glance, 都需要用到数据库。所以我们需要创建相关的数据库和用户。

应用数据库   数据库用户   密码
mysql           root            password
nova            nova            password
glance          glance          password
keystone    keystone    password



安装

mysql自动安装

cat <<MYSQL_PRESEED | debconf-set-selections
mysql-server-5.5 mysql-server/root_password password $MYSQL_PASS
mysql-server-5.5 mysql-server/root_password_again password $MYSQL_PASS
mysql-server-5.5 mysql-server/start_on_boot boolean true
MYSQL_PRESEED

Openstack都是Python写的,所以你需要python-mysqldb,安装过程,就不会提示你输入root密码

apt-get install -y mysql-server python-mysqldb

配置

编辑/etc/mysql/my.cnf, 允许网络访问mysql

#bind-address           = 127.0.0.1
bind-address            = 0.0.0.0

或者直接运行下面命令

sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mysql/my.cnf

重启mysql服务

   

service mysql restart

创建相关数据库

mysql -uroot -p$MYSQL_PASS <<EOF
CREATE DATABASE nova;
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY '$MYSQL_PASS';
CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY '$MYSQL_PASS';
CREATE DATABASE keystone;
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%'IDENTIFIED BY '$MYSQL_PASS';
FLUSH PRIVILEGES;
EOF

Keystone

Keystone是Openstack的核心,所有的组件,都需要通过keystone进行认证和授权。

租户(tenant)用户密码
adminadminpassword
servicenovapassword

glancepassword

安装

apt-get install -y keystone python-keystone python-keystoneclient


配置

编辑/etc/keystone/keystone.conf,需要修改

  • keystone的默认token是ADMIN,我这里修改成随机生成,查看novarc获得

  • 默认是采用sqlite连接,我们需要改成mysql

[DEFAULT]
#bind_host = 0.0.0.0
public_port = 5000
admin_port = 35357
#admin_token = ADMIN
admin_token = d5d892e6de00a922f9fb
[sql]
#connection = sqlite:var/lib/keystone/keystone.db
connection = mysql://keystone:password@10.1.199.17/keystone

或者运行下面命令,很多朋友都是因为修改错误导致错误,建议直接使用下面命令进行修改。

sed -i -e " s/admin_token = ADMIN/admin_token = $SERVICE_TOKEN/g" /etc/keystone/keystone.conf
sed -i '/connection = .*/{s|sqlite:///.*|mysql://'"keystone"':'"$MYSQL_PASS"'@'"$MASTER"'/keystone|g}' /etc/keystone/keystone.conf

重启服务

service keystone restart

同步keystone数据库

keystone-manage db_sync

keystone的数据库,需要导入数据和endpoint,你可以一步一步用命令行导入,可以参考keystone白皮书

为了方便,你可以直接使用下面2个脚本来进行全部的设置。

  1. keystone_data.sh导入用户信息

  2. endpoints.sh 设置endpoint



    Keystone Data

wget http://www.chenshake.com/wp-content/uploads/2012/07/keystone_data.sh_.txt
mv keystone_data.sh_.txt keystone_data.sh
bash keystone_data.sh

没任何输出,就表示正确,可以通过下面命令检查

echo $?

显示0,就表示脚本正确运行,千万不要重复运行脚本。

Endpoint 导入

wget http://www.chenshake.com/wp-content/uploads/2012/07/endpoints.sh_.txt
mv endpoints.sh_.txt endpoints.sh
bash endpoints.sh

需要注意的是,这个脚本是假设你的glance服务和swift都是安装相同的服务器,如果你的glance在不同的服务器,你需要调整一下endpoint,可以在数据库里调整。

测试

可以使用curl命令来测试。

命令的格式如下

curl -d '{"auth": {"tenantName": "adminTenant", "passwordCredentials":\
{"username": "adminUser", "password": "secretword"}}}' -H "Content-type:\
application/json" http://IP:35357/v2.0/tokens | python -mjson.tool
IP: 注意这个是你的 主机IP你需要替换一下。

你需要替换一下。

curl -d '{"auth": {"tenantName": "admin", "passwordCredentials":{"username": "admin", "password": "password"}}}' -H "Content-type:application/json" http://$MASTER:35357/v2.0/tokens | python -mjson.tool

你就可以获得一个24小时的token。(注意,上面的脚本没有创建demo用户,所以没法用demo账号去测试)

"token": {
            "expires": "2012-09-27T02:09:37Z",
            "id": "c719448800214e189da04772c2f75e23",
            "tenant": {
                "description": null,
                "enabled": true,
                "id": "dc7ca2e51139457dada2d0f7a3719476",
                "name": "admin"
            }

通过下面命令,可以检查keystone的设置是否正确。


root@node17:~# keystone user-list
+----------------------------------+---------+----------------------+--------+
|                id                | enabled |        email         |  name  |
+----------------------------------+---------+----------------------+--------+
| 1189d15892d24e00827e707bd2b7ab07 | True    | admin@chenshake.com  | admin  |
| cca4a4ed1e8842db99239dc98fb1617f | True    | glance@chenshake.com | glance |
| daccc34eacc7493989cd13df93e7f6bc | True    | swift@chenshake.com  | swift  |
| ee57b02c535d44f48943de13831da232 | True    | nova@chenshake.com   | nova   |
+----------------------------------+---------+----------------------+--------+
                                                                                                                                                                                                                                                                              
root@node17:~# keystone endpoint-list
+----------------------------------+-----------+-----------------------------------------------+-----------------------------------------------+------------------------------------------+
|                id                |   region  |                   publicurl                   |                  internalurl                  |                 adminurl                 |
+----------------------------------+-----------+-----------------------------------------------+-----------------------------------------------+------------------------------------------+
| 0b04e1baac1a4c9fb07490e0911192cf | RegionOne | http://10.1.199.17:5000/v2.0 | http://10.1.199.17:5000/v2.0 | http://10.1.199.17:35357/v2.0 |
| 0d3315627d52419fa08095f9def5d7e4 | RegionOne | http://10.1.199.17:8776/v1/%(tenant_id)s | http://10.1.199.17:8776/v1/%(tenant_id)s | http://10.1.199.17:8776/v1/%(tenant_id)s |
| 1c92290cba9f4a278b42dbdf2802096c | RegionOne | http://10.1.199.17:9292/v1 | http://10.1.199.17:9292/v1 | http://10.1.199.17:9292/v1 |
| 56fe83ce20f341d99fc576770c275586 | RegionOne | http://10.1.199.17:8774/v2/%(tenant_id)s | http://10.1.199.17:8774/v2/%(tenant_id)s | http://10.1.199.17:8774/v2/%(tenant_id)s |
| 5fb51aae00684e56818869918f86b564 | RegionOne | http://10.1.199.17:8080/v1/AUTH_%(tenant_id)s | http://10.1.199.17:8080/v1/AUTH_%(tenant_id)s | http://10.1.199.17:8080/v1 |
| aaac7663872d493b85d9e583329be9ed | RegionOne | http://10.1.199.17:8773/services/Cloud | http://10.1.199.17:8773/services/Cloud | http://10.1.199.17:8773/services/Admin |
+----------------------------------+-----------+-----------------------------------------------+-----


可以使用下面命令来查看结果

keystone tenant-list
keystone user-list
keystone role-list

Glance

Glance是提供镜像管理服务,可以理解成一个中间件,后面的存储可以是本地存储,也可以使用swift存储。

安装

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

配置

编辑 /etc/glance/glance-api-paste.ini,/etc/glance/glance-registry-paste.ini,两个文件,都是修改文档最后3行

#admin_tenant_name = %SERVICE_TENANT_NAME%
#admin_user = %SERVICE_USER%
#admin_password = %SERVICE_PASSWORD%
admin_tenant_name = service
admin_user = glance
admin_password = password


也可以直接运行下面两条命令,实现修改

sed -i -e " s/%SERVICE_TENANT_NAME%/service/g; s/%SERVICE_USER%/glance/g; s/%SERVICE_PASSWORD%/$SERVICE_PASSWORD/g; " /etc/glance/glance-api-paste.ini
sed -i -e " s/%SERVICE_TENANT_NAME%/service/g; s/%SERVICE_USER%/glance/g; s/%SERVICE_PASSWORD%/$SERVICE_PASSWORD/g; " /etc/glance/glance-registry-paste.ini


编辑/etc/glance/glance-registry.conf改成使用mysql验证

#sql_connection = sqlite:var/lib/glance/glance.sqlite
sql_connection = mysql://glance:password@10.1.199.17/glance

或者运行下面命令实现修改

sed -i '/sql_connection = .*/{s|sqlite:///.*|mysql://'"glance"':'"$MYSQL_PASS"'@'"$MASTER"'/glance|g}' /etc/glance/glance-registry.conf


编辑/etc/glance/glance-registry.conf/etc/glance/glance-api.conf,都在文件末尾添加两行

[paste_deploy]
flavor = keystone

或者运行下面命令,完成修改

cat <<EOF >>/etc/glance/glance-api.conf
[paste_deploy]
flavor = keystone
EOF
cat <<EOF >>/etc/glance/glance-registry.conf
[paste_deploy]
flavor = keystone
EOF


重启glance服务

service glance-api restart && service glance-registry restart


同步glance数据库

# glance-manage version_control 0
# glance-manage db_sync
/usr/lib/python2.7/dist-packages/glance/registry/db/migrate_repo/versions/003_add_disk_format.py:47: SADeprecationWarning: useexisting is deprecated.  Use extend_existing.
  useexisting=True)


看到下面的输出,表示正常的。

重启glance服务

service glance-api restart && service glance-registry restart


测试

glance index

没有输出,表示正常,因为目前还没有镜像。

下载Image

我们下载CirrOS的p_w_picpath作为测试使用,只有10M。如果是ubuntu官方的p_w_picpath,220M,并且ubuntu官方的p_w_picpath,都是需要使用密钥登陆。

CirrOS

下载p_w_picpath

wget https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img


上传p_w_picpath

glance add name=cirros-0.3.0-x86_64 is_public=true  container_format=bare \
disk_format=qcow2 < /root/cirros-0.3.0-x86_64-disk.img


Cirros,是可以使用用户名和密码登陆,也可以使用密钥登陆

user:cirros
password:cubswin:)

Ubuntu官方p_w_picpath

下载p_w_picpath

wget http://cloud-p_w_picpaths.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img


上传p_w_picpath

glance add name="Ubuntu 12.04 cloudimg amd64" is_public=true container_format=ovf \
disk_format=qcow2 < /root/precise-server-cloudimg-amd64-disk1.img


user:ubuntu

只能使用密钥登陆。

查看p_w_picpath

# glance index
ID                                   Name                           Disk Format          Container Format     Size         
------------------------------------ ------------------------------ -------------------- -------------------- --------------
5dcf84a0-b491-4710-8d7a-5531bce0dedc cirros-0.3.0-x86_64            qcow2                bare                        9761280
f4f62d8a-3e5b-4136-8547-ce3cb79771aa Ubuntu 12.04 cloudimg amd64    qcow2                ovf                       230817792


Nova

安装

apt-get install -y nova-api nova-cert nova-common nova-objectstore \
nova-scheduler nova-volume nova-consoleauth novnc python-nova python-novaclient \
nova-compute nova-compute-kvm  nova-network


如果你希望控制节点,不打算跑计算服务,装完后,把nova compute的服务停掉也可以。

配置

编辑 /etc/nova/api-paste.ini , 修改末尾3行

#admin_tenant_name = %SERVICE_TENANT_NAME%
#admin_user = %SERVICE_USER%
#admin_password = %SERVICE_PASSWORD%
admin_tenant_name = service
admin_user = nova
admin_password = password

或者运行下面命令进行修改

sed -i -e " s/%SERVICE_TENANT_NAME%/service/g; s/%SERVICE_USER%/nova/g; s/%SERVICE_PASSWORD%/$SERVICE_PASSWORD/g; " /etc/nova/api-paste.ini


编辑/etc/nova/nova.conf 文件,

下面是我的nova.conf 文件的配置。需要注意的一点是Essex版本的nova,配置文件不需要前面加上 — 。日后我会逐步调整nova.conf 文件,让他更加可读和方便大家理解。

为了简单,大家直接copy下面内容,运行就可以。

如果你是在虚拟机里安装,你需要吧 libvirt_type=kvm 改成 ibvirt_type=qemu

cat >/etc/nova/nova.conf <<EOF
[DEFAULT]
###### LOGS/STATE
#verbose=True
verbose=False
###### AUTHENTICATION
auth_strategy=keystone
###### SCHEDULER
#--compute_scheduler_driver=nova.scheduler.filter_scheduler.FilterScheduler
scheduler_driver=nova.scheduler.simple.SimpleScheduler
###### VOLUMES
volume_group=nova-volumes
volume_name_template=volume-%08x
iscsi_helper=tgtadm
###### DATABASE
sql_connection=mysql://nova:$MYSQL_PASS@$MASTER/nova
###### COMPUTE
libvirt_type=kvm
#libvirt_type=qemu
connection_type=libvirt
instance_name_template=instance-%08x
api_paste_config=/etc/nova/api-paste.ini
allow_resize_to_same_host=True
libvirt_use_virtio_for_bridges=true
start_guests_on_host_boot=true
resume_guests_state_on_host_boot=true
###### APIS
osapi_compute_extension=nova.api.openstack.compute.contrib.standard_extensions
allow_admin_api=true
s3_host=$MASTER
cc_host=$MASTER
###### RABBITMQ
rabbit_host=$MASTER
###### GLANCE
p_w_picpath_service=nova.p_w_picpath.glance.GlanceImageService
glance_api_servers=$MASTER:9292
###### NETWORK
network_manager=nova.network.manager.FlatDHCPManager
force_dhcp_release=True
dhcpbridge_flagfile=/etc/nova/nova.conf
dhcpbridge=/usr/bin/nova-dhcpbridge
firewall_driver=nova.virt.libvirt.firewall.IptablesFirewallDriver
public_interface=eth0
flat_interface=eth1
flat_network_bridge=br100
fixed_range=$FIXED_RANGE
multi_host=true
###### NOVNC CONSOLE
novnc_enabled=true
novncproxy_base_url= http://$MASTER:6080/vnc_auto.html
vncserver_proxyclient_address=$MASTER
vncserver_listen=$MASTER
########Nova
logdir=/var/log/nova
state_path=/var/lib/nova
lock_path=/var/lock/nova
#####MISC
use_deprecated_auth=false
root_helper=sudo nova-rootwrap
EOF

设置目录权限

chown -R nova:nova /etc/nova

重启所有服务

service rabbitmq-server restart
service libvirt-bin restart
service nova-scheduler restart
service nova-network restart
service nova-cert restart
service nova-compute restart
service nova-api restart
service nova-objectstore restart
service nova-volume restart


由于服务数量比较多,创建一个脚本 restart.sh 来重启所有服务。


#!/bin/bash
for a in rabbitmq-server libvirt-bin nova-network nova-cert nova-compute \
nova-api nova-objectstore nova-scheduler nova-volume \
novnc  nova-consoleauth; do service "$a" stop; done
for a in rabbitmq-server libvirt-bin nova-network nova-cert nova-compute \
nova-api nova-objectstore nova-scheduler nova-volume \
novnc  nova-consoleauth; do service "$a" start; done


运行脚本

bash restart.sh
Stopping rabbitmq-server: rabbitmq-server.
libvirt-bin stop/waiting
nova-network stop/waiting
nova-cert stop/waiting
nova-compute stop/waiting
nova-api stop/waiting
nova-objectstore stop/waiting
nova-scheduler stop/waiting
nova-volume stop/waiting
 * Stopping OpenStack NoVNC proxy nova-novncproxy                 [ OK ]
nova-consoleauth stop/waiting
Starting rabbitmq-server: SUCCESS
rabbitmq-server.
libvirt-bin start/running, process 9683
nova-network start/running, process 9703
nova-cert start/running, process 9713
nova-compute start/running, process 9724
nova-api start/running, process 9734
nova-objectstore start/running, process 9744
nova-scheduler start/running, process 9759
nova-volume start/running, process 9775
 * Starting OpenStack NoVNC proxy  nova-novncproxy                 [ OK ]
nova-consoleauth start/running, process 9839


同步数据库

nova-manage db sync

会有一堆的输出,不过应该是没问题的。nova数据库里已经有相应的表,就表示正确。

# nova-manage db sync
2012-07-19 18:43:34 WARNING nova.utils [-] /usr/lib/python2.7/dist-packages/sqlalchemy/pool.py:639: SADeprecationWarning: The 'listeners' argument to Pool (and create_engine()) is deprecated.  Use event.listen().
  Pool.__init__(self, creator, **kw)
2012-07-19 18:43:34 WARNING nova.utils [-] /usr/lib/python2.7/dist-packages/sqlalchemy/pool.py:145: SADeprecationWarning: Pool.add_listener is deprecated.  Use event.listen()
  self.add_listener(l)


创建Fix IP

FIX IP,就是分配给虚拟机的实际IP地址。这些数据都会写入数据库。$FIXED_RANGE 在novarc里设置。

nova-manage network create private --fixed_range_v4=$FIXED_RANGE \
 --num_networks=1 --bridge=br100 --bridge_interface=eth1 \
--network_size=256 --multi_host=T

创建floating IP

所谓Floating IP,是亚马逊EC2的定义。简单说,就是公网的IP。他其实是通过类似防火墙类似,做一个映射。实际上是通过iptables来实现映射.

nova-manage floating create --ip_range=$FLOATING_RANGE


重启nova服务

bash restart.sh
libvirt-bin stop/waiting
nova-network stop/waiting
nova-cert stop/waiting
nova-compute stop/waiting
nova-api stop/waiting
nova-objectstore stop/waiting
nova-scheduler stop/waiting
nova-volume stop/waiting
 * Stopping OpenStack NoVNC proxy nova-novncproxy                                           [ OK ]
nova-consoleauth stop/waiting
libvirt-bin start/running, process 23232
nova-network start/running, process 23252
nova-cert start/running, process 23262
nova-compute start/running, process 23273
nova-api start/running, process 23285
nova-objectstore start/running, process 23303
nova-scheduler start/running, process 23321
nova-volume start/running, process 23336
 * Starting OpenStack NoVNC proxy  nova-novncproxy                                          [ OK ]
nova-consoleauth start/running, process 23386


测试

可以尝试用下面命令去检查nova的状况

nova-manage service list

wKiom1NDdW3SKT1XAAHqYnj46Hk104.jpg